LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to remove X lines from output (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-remove-x-lines-from-output-837358/)

hurryi 10-11-2010 04:28 AM

how to remove X lines from output
 
Hello,

I would like to know how to remove X lines from output.

lets say i have a test file and i want the output without the first 2 lines

[root@node1 ~]# cat test
1
2
3
4
2
1


maybe it is very easy but i could not find the solution.

Thanks in advance.

grail 10-11-2010 04:32 AM

Quote:

but i could not find the solution.
So you have searched extensively and found nothing? I find this a little hard to believe.

How about http://www.lmgtfy.com/?q=how+to+remo...es+from+output

angel115 10-11-2010 04:35 AM

Try this:
Code:

cat test | awk 'NR > 2'
PS: Mark you post as solved if it is.

hurryi 10-11-2010 04:37 AM

lol, right i found solution with grep -v or nl and grep -v but it wont work with this file because i want to reduce the first 2 lines exactly not with some filters as the real file data is changing
maybe if there would be an option like grep -v with head -v

hurryi 10-11-2010 04:38 AM

Quote:

Originally Posted by angel115 (Post 4123690)
Try this:
Code:

cat test | awk 'NR > 2'
PS: Mark you post as solved if it is.

awk alright thanks

ghostdog74 10-11-2010 05:40 AM

Quote:

Originally Posted by angel115 (Post 4123690)
Try this:
Code:

cat test | awk 'NR > 2'
PS: Mark you post as solved if it is.

useless use of cat
Code:

awk 'NR>2' test


All times are GMT -5. The time now is 01:28 PM.