mainGNU Core Utilities - Support: sr #106713, wish: a single construct to...

 
 

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

sr #106713: wish: a single construct to replace "head | tail"

Submitter:  Richard Neill <richardneill>
Submitted:  Thu 09 Apr 2009 05:55:00 AM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  1 - Wish Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None

Fri 24 Sep 2010 08:38:23 PM UTC, comment #1: 

Sounds like a job for SED:
sed -n '15p' FILE

Matthias Bartelt <barteltm>
Thu 09 Apr 2009 05:55:00 AM UTC, original submission:  

I often write things like:
   head -n 15 FILE | tail -n 1
i.e. to extract precisely one line (the 15th here) from the file.

But that's complex, and a waste of a process.

Thus I propose two new options:
   head should gain the option:    -t [NUMBER] 
and
   tail should gain the option:    -h  [NUMBER]

These would mean pipe the output through "{head,tail} -n NUMBER"
respectively. (But this would be done within the single process, rather than actually using a pipe).

So my syntax above becomes:
   head -n 15 -t 1 FILE

Richard Neill <richardneill>

 

(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 barteltm (Posted a comment)
  • -email is unavailable- added by richardneill (Submitted the item)
  •  

    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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code