How to view content from a specific line?

To view content from a specific line in a file, you can use the tail command with the -n option, specifying the line number with a plus sign (+). Here’s how you can do it:

tail -n +<line_number> <file_name>

For example, if you want to view the content of a file named example.txt starting from the 10th line, you would use:

tail -n +10 example.txt

This command will display all lines from the 10th line to the end of the file. If you want to view content from a specific line and only a certain number of lines after that, you can use the sed command as follows:

sed -n '<line_number>,$p' <file_name>

For example, to view from the 10th line to the end of example.txt, you would use:

sed -n '10,$p' example.txt

This will print all lines starting from the 10th line to the end of the file.

0 Comments

no data
Be the first to share your comment!