in reply to Re: Search and replace in all odd lines
in thread Search and replace in all odd lines
The above will apply the changes in line numbers 1,3,5,7,......perl -i.bak -nle 's/search/replace/g unless $. & 2; print' file(s)
The above will apply the changes in line numbers 2,4,6,8,......perl -i.bak -nle 's/search/replace/g unless $. & 1; print' file(s)
NOTE: Based on the idea from Re: Search and replace in all odd lines by GrandFather
In Section
Seekers of Perl Wisdom