At 11:51 AM 6/16/00 -0500, Smith, Sheldon wrote:
>(I must be in my "dense" phase.)
>
>Various VMS utilities generate text files, and occasionally embed a <CR><LF>
>pair in the record itself, rather than simply writing two records. Typing
>the file out is no big deal, but it's a little obnoxious to read inside of
>an editor, for example, TPU.
>
>Does anybody have a snippet of code lying around that would
>   *  convert a record with embedded CR-LF pairs into multiple records, and
>   *  simply pass through all others?

Try this:

while (<>) {
   s/\cM//;
   print;
}

Or, if you'd rather do it completely from the command line, just generating 
a new version of the file:

perl -p -i -e "s/\cM//"

The one downside is that it'll get you a new record for embedded linefeeds, 
though that's relatively uncommon. Fixing that's a touch more complex, but 
certainly doable.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to