MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
March
Sun Mon Tue Wed Thu Fri Sat
     
25
 
2017
Months
Mar


Sat, Mar 25, 2017 10:56 pm

Using the more command to discard lines at the beginning of a file

If you wish to ignore lines at the start of output or in the beginning of a file, you can use the more command to do so. E.g., suppose I have a text file named fruit.txt that contains the following lines:

apple
banana
clementine
date
eggplant
fig
grape

On a Linux, Unix, or OS X/macOS system, if I want to see all lines of the file but the first one, I can use the +n, where n is a number, argument to the more command. In this case, I can use more +2 fruit.txt to start the output at the second line in the file.

$ more +2 fruit.txt
banana
clementine
date
eggplant
fig
grape
$

If I wanted to ignore the first four lines and start output at the fifth line, I could use more +5.

$ more +5 fruit.txt
eggplant
fig
grape
$

[ More Info ]

[/os/unix/commands] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo