how do i read a particular line from the text file..
THere is a text file. i want to read only every 5th line and then awk the value i need in that line, 3rd word... how can i do it in bash shell script? please help me as soon as possible.
|
cat yourfile.txt | grep -En ^ | grep -E ^[0-9]*[05]: | perl -pe 's/^[0-9]+://;s/^\s*\S*\s*\S*\s*$//;s/\S+\s+\S+\s+(\S+).*/$1/'
|
are these every 5th lines different in any way ? is it possible to filter by using grep ? that would make it easy
Code:
grep 'some.filter' file.txt|awk .... Code:
#!/bin/bash |
You could use
awk 'NR%5==0 { print $3 }' file The mod expression will select every 5th line. The print function prints out the 3rd record. |
All times are GMT -5. The time now is 05:29 PM. |