Package: moreutils

----- Forwarded message from Mark Crutch <[EMAIL PROTECTED]> -----

From: Mark Crutch <[EMAIL PROTECTED]>
Date: Mon, 23 Apr 2007 14:47:00 +0100
To: [EMAIL PROTECTED]
Subject: A suggestion for moreutils
User-Agent: Thunderbird 2.0.0.0 (Windows/20070326)

Hi,

I recently discovered moreutils via planet.ubuntu.com when it was
featured as the Debian Package of the Day, and have found it to be
extremely useful (especially "combine" which has saved me a lot of grief
recently).

I'd like to suggest a possible addition to the collection: a more
powerful version of "cut". To be precise, the normal version of cut
suffers from one major limitation: it will only output fields in the
order in which they appeared in the source. For example, if you use
something like " ls -l | tr -s' ' |cut -d' ' -f1,8 " you would get lines
like this:

        drwxr-xr-x some_filename.txt

But if you use " ls -l | tr -s' ' | cut -d' ' -f8,1 " (i.e. trying to
re-order the columns), you get:

        drwxr-xr-x some_filename.txt

rather than the "some_filename.txt drwxr-xr-x" that you wanted. You also
can't output a column more than once, so "cut -f1,2,1" is the same as
"cut -f1,2".


This restriction seriously limits the capabilities of "cut". I've often
been faced with a CSV file or something similar from which I just needed
to extract certain columns, but not in a strictly ascending order.
Invariably the O'Reilly Sed & Awk book comes off the shelf; awk does the
job well enough, but syntactically it's serious overkill compared with
simply listing the field numbers in "cut".

Another use case is for "temporarily" rearranging the columns to pipe
through to another tool, before rearranging them back again. For
example, consider a CSV file containing NAME,SURNAME,ADDRESS,PHONE:
sorting them by surname, but leaving the format unchanged, would be as
simple as "cut -f2,1- FILE.csv | sort | cut -f2-". In other words, "take
a copy of the second column and prepend it to each row, sort, then chop
off the prepended column".


If you consider this to be worth pursuing any further then please let me
know so that I can detail the syntax more precisely. If you decide that
it's not worth implementing, then feel free to add it to your list of
rejected proposals on the website.

Regards,

Mark

###########################################This message has been scanned by 
F-Secure Anti-Virus for Microsoft 
Exchange.Formore information, connect to http://www.F-Secure.com/ 


----- End forwarded message -----

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to