bugGNU Core Utilities - Bugs: bug #12361, Feature: cut by column pattern

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #12361: Feature: cut by column pattern

Submitter:  None
Submitted:  Fri 18 Mar 2005 08:14:54 AM UTC
   
 
Category:  None Severity:  1 - Wish
Item Group:  None Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Mon 10 Dec 2007 07:50:16 AM UTC, comment #1: 

Thanks for the suggestion, but since it's so easy to do with other tools, it would be counter-productive to add the feature to cut.

Jim Meyering <meyering>
Group administrator
Fri 18 Mar 2005 08:14:54 AM UTC, original submission:  

It would be very useful if the cut command could select fields by matching a specified regular expression to the first row fields. 

For example, if file1 is a tab-separated file containing

Hello a1 bye a7
0.1   0  3   3.2
0.3   9  6   1.8

then the command

  cut -n "a[0-9]" file1

might output

a1 a7

  1.  3.2

9  1.8

It may be equivalent to the cumbersome

  cut -f $(head -1 file1|tr '\t' '\n'|grep -n "a[0-9]"|sed -r 's/:.*//') file1

But it would probably be more useful to match the regular expression to the whole field, like sed, rather than any part of the field, like grep.  This can, of course be done using awk.

The output fields would be ordered as in the input file, I suppose.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by meyering (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-12-10 meyering StatusNone Wont Fix
        Open/ClosedOpen Closed
    2007-12-10 meyering Severity3 - Normal 1 - Wish

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code