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

Submitted by:  None
Submitted on:  Fri 18 Mar 2005 08:14:54 AM UTC  
 
Category: NoneSeverity: 1 - Wish
Item Group: NoneStatus: Wont Fix
Privacy: PublicAssigned 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>
Project 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

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 10 Dec 2007 07:50:16 AM UTCmeyeringStatusNone=>Wont Fix
      Open/ClosedOpen=>Closed
    Mon 10 Dec 2007 07:50:15 AM UTCmeyeringSeverity3 - Normal=>1 - Wish

    Back to the top


    Powered by Savane 3.1-cleanup1