I have a file that has around million lines. I need to go to line number 320123 to check the data. How do I do that?
This question is tagged with
~ Asked on 2011-12-21 08:04:01
n being the line number:
ng: Jump to line number n. Default is the start of the file.
nG: Jump to line number n. Default is the end of the file.
So to go to line number 320123, you would type
Copy-pasted straight from Wikipedia.
~ Answered on 2011-12-21 08:08:03
To open at a specific line straight from the command line, use:
less +320123 filename
If you want to see the line numbers too:
less +320123 -N filename
You can also choose to display a specific line of the file at a specific line of the terminal, for when you need a few lines of context. For example, this will open the file with line 320123 on the 10th line of the terminal:
less +320123 -j 10 filename
~ Answered on 2014-03-06 11:02:17