Hi Monks, I have the perl one liner to strip the carriage return, but i only want to execute the search and replace on every line if the header contains it. This way i don't unnecessarily go thru every line doing a search and replace. If the header has it, I can assume the rest of the file will have it...then i'll run it on every line in the file.
This is what i have, but it's only doing it on the header record. Does anyone know how to use a one liner to accomplish my intended goal?
perl -i -pe 's/\r//g if $. ==1 && /\r/' <filename>
Thanks a lot.
In reply to One Liner to strip crlf by dirtdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |