Tail – print from specific line number

 

We can  print from specific line number to end of file from given input file.

Example:

Consider that we have a input file with letters a to z, where each letter placed in a line. So we will have 26 lines.

Lets say if we want to print from line 21 to end of file use following command:

$ tail -n +21<inputFile>

Output:

u
v
w
x
y
z

To print last six line from a file:

$ tail -n -6 <inputFile>

Output:

u
v
w
x
y
z

-Sany

Advertisements

One comment on “Tail – print from specific line number

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s