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 sed: sed 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
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
Post a Comment