helpGNU 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"

Submitted by:  Richard Neill <richardneill>
Submitted on:  Thu 09 Apr 2009 05:55:00 AM UTC  
Category: NonePriority: 5 - Normal
Severity: 1 - WishStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating 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]
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>


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

    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):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1