To print one line (5)
$ sed -n 5p file
Line 5
To print multiple lines (5 & 8)
$ sed -n -e 5p -e 8p file
Line 5
Line 8
To print specific range (5 - 8)
$ sed -n 5,8p file
Line 5
Line 6
Line 7
Line 8
To print one line (5)
$ sed -n 5p file
Line 5
To print multiple lines (5 & 8)
$ sed -n -e 5p -e 8p file
Line 5
Line 8
To print specific range (5 - 8)
$ sed -n 5,8p file
Line 5
Line 6
Line 7
Line 8
转载于:https://www.cnblogs.com/chucklu/p/10573514.html