[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #19337] Whish: Include Option to view first line of file/stream
From: |
Allen Halsey |
Subject: |
[bug #19337] Whish: Include Option to view first line of file/stream |
Date: |
Thu, 13 Mar 2008 23:47:45 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12 |
Follow-up Comment #3, bug #19337 (project grep):
I've often wanted this functionality and would welcome a 'head' option to
grep. I feel it is similar to the A and B options in that it provides
additional context. '--head=2' would include the first two lines of STDIN.
'--head' would assume a default of 1 line.
In SQL, if I do:
SELECT * from EMP;
I get column headers followed by the data. If I filter the rows by adding a
WHERE clause, I still get the column headers. Likewise, if I filter the output
of 'ps aux', I still want the column headers.
I did come up with a workaround:
$ ps aux | (read line; echo "$line"; grep foo)
On some systems, this can be shortened to:
$ ps aux | (head -1; grep foo)
but that didn't work consistently for me across all systems I work on. I
suspect it only works with the most recent versions of coreutils. (If someone
knows why, please add to the discussion.)
Allen Halsey
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?19337>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #19337] Whish: Include Option to view first line of file/stream,
Allen Halsey <=