Monday, November 19, 2012

head and tail for shell scripting

Hey guys,

Do you know the head and tail commands?
For example,

head -10 abc.txt > abc_left.txt
tail -10 abc_txt > abc_right.txt

  • The first command will read the first 10 lines from abc.txt and write them into a abc_left.txt file
  • The second command will read the last 10 lines from abc.txt and write them into a abc_right.txt file

Cool isnt' it?

Cheers!


No comments:

Post a Comment