bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep RFE: End-of-Line choices


From: Mabry Tyson
Subject: grep RFE: End-of-Line choices
Date: Tue, 24 Feb 2004 17:19:11 -0800
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113

In Mac OS X, we deal with files that end with LF (Unix) or CR (Mac) endings, and sometimes with CR LF endings. With the dual nature of Mac OS X (being partly Unix and yet supporting the previous Mac files), it is likely that this situation will remain for a long time. It is a real pain for grep to return the entire file as a single line when it searchs a file with Mac end-of-line conventions.

Apparently for DOS/Windows, grep has the capability for dealing with files that have either a CR LF or LF ending.

I would like to encourage the inclusion of the DOS capability for allowing CR LF to be accepted (under a switch to grep) and to add the capability to accept line endings that are CR instead of LF. This could be done by doing the same coding as for CR LF, but instead of dropping the CR, change it to LF.

It seems unlikely that you could find a single character switch to control this. My suggestion would be something like
  --eol=<vals>
where <vals> =  <eol>(,<eol>)*
where <eol> = LF | CR | CRLF
The default would be OS-specific. For most unix systems, it would be LF. For DOS/Windows, it would be LF,CRLF. For Mac OS X, it should be LF,CR.

I don't know if there are other EOL conventions that might also be adopted in the same edit.








reply via email to

[Prev in Thread] Current Thread [Next in Thread]