Results 1 to 6 of 6
I would like to find a commando that would enable me to exract a row from a textfile.
input:
1 1 1 1
2 2 2 2
3 3 3 ...
- 01-26-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
rows
I would like to find a commando that would enable me to exract a row from a textfile.
input:
1 1 1 1
2 2 2 2
3 3 3 3
output
2 2 2 2
Best wishes,
Adam
- 01-27-2009 #2
Hmmm, this looks like you're asking us to help you with your homework... Maybe you should read your coursebooks a bit more - but you could also try grep.
Linux user #126863 - see http://linuxcounter.net/
- 01-27-2009 #3Just Joined!
- Join Date
- Dec 2007
- Location
- Bangalore
- Posts
- 33
You could try with a combi of head and tail commands
- 01-27-2009 #4Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
I have no course and I have no coursebook. I'm just in need of creating a small bash script and I have very little time to browse through the litterature.
It seemed to be a very simple problem so I figured that someone who knows linux could solve it in a few seconds while I have already spent some hours with the script. I would be very thankfull for the help.
- 01-27-2009 #5Just Joined!
- Join Date
- Dec 2007
- Location
- Bangalore
- Posts
- 33
This should work:
$ head -n <filename> | tail -1
where n= the number of the row to be printed
- 01-27-2009 #6Just Joined!
- Join Date
- Jan 2009
- Posts
- 3
Thanks!


Reply With Quote