I have two executable sed scripts at a location that is in my PATH
Code:
$ cat indent+
#!/usr/bin/sed -f
# Doubles the number of leading spaces
s/^ */&&/
$ cat indent-
#!/usr/bin/sed -f
# Halves the number of leading spaces
s/^\( *\)\1/\1/
If I want to double or halve the number of leading spaces on my test.awk file then I run
Code:
indent+ test.awk
indent- test.awk
and redirect the output to a new file.
If you use tab characters then first replace them with spaces, by using the
expand command.
Example
Code:
expand test.awk | indent- > newtest.awk