If I want to an in-place update of a file with perltidy, how can I do it? Let's say I want to run perl-tidy on foo.pl but I want to the changes to be in foo.pl
How can I do an in-place update of a file with perltidy?
437 Views Asked by Evan Carroll At
2
There are 2 best solutions below
1
On
It looks like perltidy has a native solution. Not all programs do. The sponge utility can be used to achieve in-place editing for programs that don't natively support it.
prog file | sponge file
You would use the options
-band-bext='/'Taken from the man page
Make sure you don't have
-stprovided or the-band-bextoptions do nothing; this was actually my problem.