Show few lines from a file with sed


/ Published in: Bash
Save to your folder(s)

Some times you need some specific range of lines from a file and the commands 'head' and 'tail' are not enough for you. This could be a easy solution for this problem.


Copy this code and paste it in your HTML
  1. # show from line 12 to line 23
  2. sed -n '12,23 p' archivo.txt
  3.  
  4. # or just one (line 15)
  5. sed -n 15p archivo.txt

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.