mamweb/convert_spaces_to_tabs.sh
2019-05-11 01:15:05 +02:00

17 lines
231 B
Bash
Executable file

#!/bin/sh
if test "$#" -lt 1
then
echo "Usage: $0 file ..."
exit 2
fi
for file in "$@"
do
# Do the sed magic: keep replacing 4 spaces at the begining of line
sed -i -re '
: loop
s/^( *) /\1 /
t loop
' "$file"
done