[Pdx-pm] data munging: line-endings
Colin Kuskie
ckuskie at dalsemi.com
Tue Oct 14 13:14:23 CDT 2003
On Tue, Oct 14, 2003 at 10:28:10AM -0700, Thomas Keller wrote:
> It's straightforward to filter line endings, but I don't know how to
> check for a particular line ending without opening the file in BBEdit
> and using it's page info menu. Is there a kind of stat module that
> quickly determines the line ending characters and allows them to be
> filtered automagically?
I don't think so. To do that, the module would have to know how
to analyze the content of each file to recognize lines without
using line endings. That's easy for a human, but might be
complex based on the format of the line(s).
If you're trying to take care of files from DOS and Unix,
then this would work:
s/\s*$//;
which would take care of:
\n
\r\n
Otherwise, if you'd post a little more detail, then it'd be easier
to help with a solution.
Colin
More information about the Pdx-pm-list
mailing list