Wednesday, 11 July, 2007

Some Commands more than HEAD and TAIL

If you want to print a file from 'N'th line to EOF means the commands "head" and "tail" alone will not help. Some possible solutions

Here i take N=25

1)Simple method

$ cat filename.txt | tail -$(echo $((`cat filename.txt| wc -l`-25)))

2)Without Cat

$ FILE=filename.txt
$ tail -n $(($(wc -l <$FILE)-24)) $FILE

3)Using awk

$ awk 'NR>24'

you can try 'sed' also

No comments: