Search This Blog

Sunday, 5 October 2014

Head –Tail Commands



TO PRINT THE LINES USING head COMMAND
head -10 File.txt >FileA.txt
This prints the first ten lines to FileA.txt
TO PRINT THE LINES USING tail COMMAND

tail -10 File.txt >FileA.txt
This prints the last ten lines to FileA.txt
Combined use of head and tail is given below.
head -5 Path/FileName_test.txt|tail -1 > Path/FileName_temp.txt

The above command will print the 5th line contained in the FileName_test.txt to FileName_temp.txt

No comments:

Post a Comment