4. Sed line number control

  • sed -n ‘1d’ files

just delete the first line

  • ‘2,5p’ 表示 prints all the lines from 2 to 5

  • ($) which represents the last line of the file

  • '2,+4 p' books.txt prints the next 4 lines from the second line

  • ‘M~n’ 50~5 matches line number 50, 55, 60, 65, and so on.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325882812&siteId=291194637