perl -0777lpwi -030e0 file 0777 Set $/ to 0777. l Chomp $\ and set $\ = $/. Thus $\ = 0777. p Loop over file and print. w Turn warnings on. i Make the changes in-place. 030 Set $/ to 030 (^X). $\ is still 0777. e0 Empty program.
So in effect this splits the file into records divided by ^X, chomps ^X from the end of each record and prints out the records with 0777 appended at the end. However, (and I'm not certain about this) since there is no character with that value it actually appends ''. Thus, the ^X's are removed from the file.
So in a way the program is functionally equivalent to: perl -i -pe 's/\30//g' file
I say functionally equivalent since there is no aesthetic equivalence. :-)
--
John.
In reply to Re: Re: Removing Control Characters from a File
by jmcnamara
in thread Removing Control Characters from a File
by Banky
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |