How Do You Get a Specific Line from a File Linux?
Contents How Do I Go to a Specific Line in a File in Linux? How to Display Specific Lines of a File in Linux Command Line Display Specific Lines Using Head and...
Contents
How do I go to a specific line in a file in Linux?
How to Display Specific Lines of a File in Linux Command Line
- Display specific lines using head and tail commands. Print a single specific line. Print specific range of lines.
- Use SED to display specific lines.
- Use AWK to print specific lines from a file.
2 авг. 2020 г.
Must Read
How do I extract a specific line from a file in Unix?
To extract a range of lines, say lines 2 to 4, you can execute either of the following:
- $ sed -n 2,4p somefile. txt.
- $ sed ‘2,4! d’ somefile. txt.