From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: grep problem Date: Sat, 11 Aug 2001 09:23:08 +0300 Lines: 24 Message-ID: <3B74CF4C.20989E7C@is.elta.co.il> References: <3B744A1F DOT 1B1E41A4 AT cyberoptics DOT com> NNTP-Posting-Host: 192.116.55.139 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 997511013 7674478 192.116.55.139 (16 [61365]) X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eric Rudd wrote: > > grep "string" file > > it lists to the screen just fine. If I try to pipe it through "more" > > grep "string" file | more > > the DOS line terminators change to Unix line terminators, and the screen > output is a mess. The same problem exists with file redirection This is a feature: the DJGPP port of Grep preserves the end-of-line format of the original file, except when its stdout is the console device (because switching the console device to binary mode has unpleasant side-effects). It does so because a filter should not alter the file more than it was asked to; in particular, if Grep doesn't modify the input at all (i.e., all its lines match), the output should be binary-identical to input. As for viewing the output, don't use `more'; use Less, which is more than `more' ;-). Less can handle Unix and DOS end-of-line format with equal grace. Note that you would have the same trouble viewing the original file with `more'.