hey how can i remove headers and tails from a sequential file
i have three lines as headers and 4 lines are tails.........
header and tailer sequential file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Does your UNIX support +3 option for the head command and the +4 option for the tail command? If so, you have a very easy filter you could use to get the detail rows only.
"First line is column names" will ignore only one row, not three.
"First line is column names" will ignore only one row, not three.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If "head +" option didn't work with the first option suggested by Ray, then the following can be used.
Code: Select all
head -$(expr $(wc -l filename | awk '{ print $1 }') \- 4) filename | tail +4
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
use:
Code: Select all
sed '1,3 d' f | sed -e :a -e '$d;N;2,4ba' -e 'P;D'
If women didn't exist, all the money in the world would have no meaning.
-- Aristotle Onassis
-- Aristotle Onassis