in reply to Remove the ^M Character from a Document
On a similar note, the other day I had a postscript file with
an embedded pixmap graphic which contained line breaks represented
only as "\r", in addition to the usual DOS "\r\n" at the
end of each line. The graphic with the \r's came up, in Unix,
as a single over-900K line, which broke most programs I tried
to use to manipulate the file (those programs were not written in
Perl, clearly :-)
So based on this snippet, I came up with the following one-liner:
which solved my problem.perl -pi -e 's/\r\n?/\n/g' <i>file</i>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Remove the ^M Character from a Document
by hacker (Priest) on Jun 03, 2002 at 16:07 UTC | |
by Abigail-II (Bishop) on Jun 03, 2002 at 16:18 UTC | |
by Sifmole (Chaplain) on Jun 03, 2002 at 18:01 UTC | |
by Abigail-II (Bishop) on Jun 03, 2002 at 18:21 UTC | |
by hacker (Priest) on Jun 04, 2002 at 12:55 UTC | |
| |
by Sifmole (Chaplain) on Jun 03, 2002 at 18:37 UTC |
In Section
Cool Uses for Perl