in reply to Re: Find Replace
in thread Find Replace

Perfect. The one liner did just the thing

Exactly what I needed it to do... But couldn't get the syntax.
Thank you so much!

Replies are listed 'Best First'.
Re^3: Find Replace
by SimTech (Initiate) on Dec 16, 2011 at 03:43 UTC

    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
      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
      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.