Tags: bash

Sed

Oct 31, 2020 5 min.

SED: Delete lines from file (delete command) SED: Extract specific lines from a file (print command) To extract line 3 and 5 sed -n -e '3p' -e '5p' my.txt or semi colon separated sed -n -e '3p;5p' my.txt Extract range of lines - e.g. get lines from 2 to 5 sed -n -e '2,5 p' my.txt Extract last line of the file sed -n -e '$ p' my.