tags:

views:

44

answers:

1

Hello, I have a large txt file, using CLI I can take a look at the beginning of the file using"

head file.txt

at the end:

tail file.txt

How do I take a look at the 10 percent of the file, 20 percent of the file, etc?

A: 

You can create an alias for "mid" to select a range of lines.

As for percentages, you'll probably need a script instead of a one liner so that you determine how many lines are in the file and then what line 10% starts at

alias mid 'tail -n +\!:1 \!:3* | head -n \!:2'

See: http://www.fastechws.com/tricks/unix/head_tail_mid_files.php

Chad