sed command regex example

In this tutorial, To use sed command regex such as: Lines starting from A till B printed, how to print between A line to B line , so on.

sed command regex example

The content sed_test file as picture below:


Lines starting from 10 line till 15 line printed 
[huupv@huupv ~]$ sed -n '10,12p' sed_test
The output as below:
    10    operator:x:11:0:operator:/root:/sbin/nologin
    11    games:x:12:100:games:/usr/games:/sbin/nologin
    12    ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
How to Lines starting from 10 line till end line printed 
[huupv@huupv ~]$ sed -n '10,$p' sed_test 
The output as picture below:

Conclusion 

Thought the article, you can printed line to line of file use sed command. How to Lines starting from A line till end line printed 


Comments

Popular posts from this blog

zimbra some services are not running [Solve problem]

Bash script list all IP addresses connected to Server

How to install php7 on centos 6