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

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

Re: Garbled print order


From: Andrew J. Schorr
Subject: Re: Garbled print order
Date: Tue, 13 Dec 2005 18:00:17 -0500
User-agent: Mutt/1.4.1i

On Tue, Dec 13, 2005 at 05:28:04PM -0500, John.Cowan wrote:
> Bill Rugolsky Jr. scripsit:
> 
> > ipconfig | awk -v 'RS=\r*\n' '$1 == "IP" {print $NF"suffix" }'
> 
> And yet another is:
> 
> $ ipconfig | tr -d '\015' | awk '$1 == "IP" {print $NF"suffix" }'

My 2 cents: Bill's solution is best if you are using a version
of awk (such as gawk) where RS is not limited to being a
one-character string.  But if you are stuck with a version
of awk that cannot handle a multi-char (or regexp) RS,
then my version using sub() is nice.  But in general,
I suspect it is typically more efficient to avoid adding
another process (such as dos2unix or tr or sed) to the pipeline.

Regards,
Andy




reply via email to

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