Print the first seven lines of a file using sed: sed 7q | delete from line 3 up to end: sed 3,/^$/d filename

Print the first seven lines of a file using sedsed 7q <file>

delete from line 3 up to and including first blank line: sed 3,/^$/d filename
ubu1404@ubuntu1404lb01:~$ cat f
1
2
3
4
5
ubu1404@ubuntu1404lb01:~$ sed 3,/^$/d f
1
2
ubu1404@ubuntu1404lb01:~$ seq 6 >> f
ubu1404@ubuntu1404lb01:~$ sed 3,/^$/d f
1

2

Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all