[Top][All Lists]

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

Re: [PATCH] [cut] Treat consecutive delimiters as one in cut binary

From: Joe Maimon
Subject: Re: [PATCH] [cut] Treat consecutive delimiters as one in cut binary
Date: Wed, 10 Mar 2004 14:07:05 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7a) Gecko/20040219

Jim Meyering wrote:

Joe Maimon <address@hidden> wrote:
When using the -d option I find it frustrating that arbitrary whitespace
ruins the field count.

witness this script:

dig -x $addr +noall +answer | grep -v '^;' | grep -v '$^' | expand | cut
-d' ' -f5 -z

With the new option in this patch, you can rely on the behavior to
produce a hostname if there is one. Otherwise you cant.

How about filtering the output through tr -s ' ' just before cut?
Then your script won't have to rely on less-portable features.

tr is usefull. And I would certainly use that on scripts that dont remain local. But this is a trivial to add feature. And it easily works for whatever delimiter is in use.
Thanks for your feedback and for the tip.


reply via email to

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