Advertisement
Xyberviri

sed: Select Last/First/Section in output.

Dec 11th, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.25 KB | None | 0 0
  1. #Select first line
  2. seq 1 4 | sed -e '$!d'
  3. seq 1 4 | tail -1
  4.  
  5. #Select last line
  6. seq 1 4 | sed '1!d'
  7. seq 1 4 | head -1
  8.  
  9. #select lines 2-3
  10. seq 1 4 | sed '2,3!d'
  11.  
  12. #http://linuxcommando.blogspot.com/2008/03/using-sed-to-extract-lines-in-text-file.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement