in reply to Re^2: Find Replace
in thread Find Replace

Nuts - unpost.

Seems I was able to make it work perfectly on a Unix system at the house with a file I made up to resemble the working version. At work on RH Linux - it does not work - as entered as a one line blurp from a command line - it will change all DOWNS to UP. Regardless of the aircraft type.

I am reluctant to remove the ^M EOL, only because I have no control over the programs that are reading the files. Back to the drawing board -- thanks again for all the help - if anyone has another suggestion, I'm ready for it!

Rob

Replies are listed 'Best First'.
Re^4: Find Replace
by graff (Chancellor) on Dec 16, 2011 at 04:08 UTC
    If the file(s) in question contain no 0x0a (line-feed) characters, then just change 0x0d (carriage-return) to line-feed "temporarily" to make your normal line-oriented processing easier, then change it back:
    perl -pe 'tr/\x0d/\x0a/' source.file | easy_line_filter | perl -pe 'tr +/\x0a/\x0d/' > edited.source.file
Re^4: Find Replace
by kennethk (Abbot) on Dec 16, 2011 at 16:12 UTC
    The one-liner should have worked if your file matched the description. One possibility is that the regex I gave you matches all Cessnas, not just the 152. If that is the source of the issue, you can swap the "grab all digits" (\d+) clause with the literal you are looking for (152). Otherwise, you need to distribute the literal file, so I can grab it, warts and all, to check what's going on.