in reply to Search and replace in all odd lines
If you want to modify all the odd lines of the file in place you can use something like:
perl -i.bk -lne 's/foo/bar/g if $.%2;print;' foo.txt
This will substitute all the foo's into bar's that appears in odd lines of the file foo.txt (saving a backup of the original file in foo.txt.bk)
Hope this helps
citromatik
|
---|