cat: output specific number of lines
Can cat command output specific number of lines? Example, output lines from 1 to 10 .
|
Try using head:
head -10 /path/to/file |
Quote:
With two parameters ? |
head -30 /path/to/file | tail -20
print the last 20 of the first 30 lines ie 10-30 |
I think the solution
Quote:
#This from line 5 to line 10 awk 'NR >= 5 && NR <= 10' <file-path/file.dat> #This from line 1 to line 10 awk 'NR >= 1 && NR <= 10' <file-path/Samefile.dat> Regards.:) |
Quote:
|
Quote:
Lines can be selected using a combination of head and tail, columns by using cut, and there are many alternate solutions using things like Perl, awk, python, php, and any of hundreds of other tools. What have you attempted to apply to the problem? (Other than 'cat'.) |
Actually- Purely as an exercise, because using sed is so much easier, but using a script I suppose you could 'technically' say that you are using cat to do so:
Code:
num=1 |
Easy with sed
Code:
sed -n '10,30p' input Code:
sed '10,30!d' input Quote:
|
All times are GMT -5. The time now is 05:54 PM. |