Linux sed usage
SED usage
Sed is an online editor that processes a single line of content at a time. When processing, stores the currently processed rows in a temporary buffer, called the pattern space
The contents of the buffer are then processed with the SED command, and the contents of the buffer are sent to the screen after processing is completed. Then the next line is processed, so it repeats until the end of the file.
The file content does not change unless you use redirection to store the output.
SED is mainly used to automatically edit one or more files, to simplify the repeated operation of the file, to write the conversion program and so on.
1. Additions/deletions to behavioral units
(1) The contents of/etc/passwd and the 2nd to 5th line are deleted, and then saved in Passwd_sed.txt
cp/etc/passwd/root/shell/
[[email protected] shell]# cat passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/ sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/ lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/ sbin:/sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/ Nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30 : Gopher:/var/gopher:/sbin/nologinftp:x:14:50:ftp user:/var/ftp:/sbin/nologinnobody:x:99:99:nobody:/:/sbin /nologindbus:x:81:81:system message bus:/:/sbin/nologinusbmuxd:x:113:113:usbmuxd user:/:/sbin/ Nologinrpc:x:32:32:rpcbind daemon:/var/cache/rpcbind:/sbin/nologinoprofile:x:16:16:special user account to be used by oprofile:/home/oprofile:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrtkit:x:499:497:realtimekit:/proc:/sbin/nologinabrt:x:173:173::/etc/abrt:/sbin/ nologinhsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologinavahi-autoipd:x:170:170:avahi ipv4ll stack:/var/ lib/avahi-autoipd:/sbin/nologinapache:x:48:48:apache:/var/www:/sbin/nologinsaslauth:x:498:76: "Saslauthd User ":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:rpc service user:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:anonymous nfs user:/var/ lib/nfs:/sbin/nologinhaldaemon:x:68:68:hal daemon:/:/sbin/nologingdm:x:42:42::/var/lib/gdm:/sbin/ nologinntp:x:38:38::/etc/ntp:/sbin/nologinpulse:x:497:495:pulseaudio system daemon:/var/run/pulse:/ Sbin/nologinwebalizer:x:67:67:webalizer:/var/www/usage:/sbin/nologinsshd:x:74:74:privilege-separated ssh :/var/empty/sshd:/sbin/nologintcpdump:x:72:72::/:/sbin/nologinuserlog:x:816:816::/home/userlog:/bin/bashtomcat : x:815:815::/home/tomcat:/bin/bashmanager:x:817:817::/home/manager:/bin/bashcloudera-scm:x:496:492:cloudera manager:/var/lib/ cloudera-scm-server:/sbin/nologinflume:x:495:490:flume:/var/lib/flume-ng:/bin/falsehdfs:x:494:489:hadoop hdfs:/var/lib/hadoop-hdfs:/bin/bashsolr:x:493:488:solr:/var/lib/solr:/sbin/nologinzookeeper:x:492:487: Zookeeper:/var/lib/zookeeper:/bin/falsellama:x:491:486:llama:/var/lib/llama:/bin/bashhttpfs:x:490:485:hadoop httpfs:/var/lib/hadoop-httpfs:/bin/bashmapred:x:489:484:hadoop mapreduce:/var/lib/hadoop-mapreduce :/bin/bashsqoop:x:488:483:sqoop:/var/lib/sqoop:/bin/falseyarn:x:487:482:hadoop yarn:/var/lib/hadoop-yarn :/bin/bashkms:x:486:481:hadoop kms:/var/lib/hadoop-kms:/bin/bashhive:x:485:480:hive:/var/lib/hive:/bin/ Falsesqoop2:x:484:479:sqoop 2 user:/var/lib/sqoop2:/sbin/nologinoozie:x:483:478:oozie user:/var /lib/oozie:/bin/falsehbase:x:482:477:hbase:/var/lib/hbase:/bin/falsesentry:x:481:476:sentry:/var/lib/sentry:/ Sbin/nologinimpala:x:480:475:impala:/var/lib/impala:/bin/bashspark:x:479:474:spark:/var/lib/spark:/sbin/nologinhue:x:478:473:hue:/usr/lib/hue:/ Bin/falseoracle:x:818:819::/home/oracle:/bin/bashinfa:x:819:821::/home/infa:/bin/bashzabbix:x:477:472:zabbix monitoring system:/var/lib/zabbix:/sbin/nologin
cat passwd | sed ' 2,5d ' > passwd_ Sed.txt
[[Email protected] shell]# cat passwd_sed.txt root:x:0:0:root:/root:/bin/bashsync:x : 5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x : 8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:o perator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/gopher:/ SBIN/NOLOGINFTP:X:14:50:FTP USER:/VAR/FTP:/SBIN/NOLOGINNOBODY:X:99:99:NOBODY:/:/SBIN/NOLOGINDBUS:X:81:81: SYSTEM MESSAGE BUS:/:/SBIN/NOLOGINUSBMUXD:X:113:113:USBMUXD USER:/:/SBIN/NOLOGINRPC:X:32:32: Rpcbind daemon:/var/cache/rpcbind:/sbin/nologinoprofile:x:16:16:special user account to be used by OProfile:/home/oprofile:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrtkit:x:499:497:realtimekit:/proc:/sbin/nologinabrt:x:173:173::/etc/abrt:/ Sbin/nologinhsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologinavahi-autoipd:x:170:170:avahi ipv4ll stack:/var/lib/avahi-autoipd:/sbin/ nologinapache:x:48:48:apache:/var/www:/sbin/nologinsaslauth:x:498:76: "Saslauthd user":/var/empty/saslauth :/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:rpc service user:/var /lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:anonymous nfs user:/var/lib/nfs:/sbin/nologinhaldaemon : x:68:68:hal daemon:/:/sbin/nologingdm:x:42:42::/var/lib/gdm:/sbin/nologinntp:x:38:38::/etc/ntp:/sbin/ NOLOGINPULSE:X:497:495:PULSEAUDIO SYSTEM DAEMON:/VAR/RUN/PULSE:/SBIN/NOLOGINWEBALIZER:X:67:67: webalizer:/var/www/usage:/sbin/nologinsshd:x:74:74:privilege-separated ssh:/var/empty/sshd:/sbin/ nologintcpdump:x:72:72::/:/sbin/nologinuserlog:x:816:816::/home/userlog:/bin/bashtomcat:x:815:815::/home/ tomcat:/bin/bashmanager:x:817:817::/home/manager:/bin/bashcloudera-scm:x:496:492:cloudera manager:/var/ Lib/cloudera-scm-server:/sbin/nologinflume:x:495:490:flume:/var/lib/flume-ng:/bin/falsehdfs:x:494:489:hadoop hdfs:/var/lib/hadoop-hdfs:/bin/ bashsolr:x:493:488:solr:/var/lib/solr:/sbin/nologinzookeeper:x:492:487:zookeeper:/var/lib/zookeeper:/bin/ Falsellama:x:491:486:llama:/var/lib/llama:/bin/bashhttpfs:x:490:485:hadoop httpfs:/var/lib/hadoop-httpfs :/bin/bashmapred:x:489:484:hadoop mapreduce:/var/lib/hadoop-mapreduce:/bin/bashsqoop:x:488:483:sqoop:/var /lib/sqoop:/bin/falseyarn:x:487:482:hadoop yarn:/var/lib/hadoop-yarn:/bin/bashkms:x:486:481:hadoop Kms:/var/lib/hadoop-kms:/bin/bashhive:x:485:480:hive:/var/lib/hive:/bin/falsesqoop2:x:484:479:sqoop 2 user:/var/lib/sqoop2:/sbin/nologinoozie:x:483:478:oozie user:/var/lib/oozie:/bin/falsehbase:x : 482:477:hbase:/var/lib/hbase:/bin/falsesentry:x:481:476:sentry:/var/lib/sentry:/sbin/nologinimpala:x:480:475 : impala:/var/lib/impala:/bin/bashspark:x:479:474:spark:/var/lib/spark:/sbin/nologinhue:x:478:473:hue:/usr/lib/ hue:/bin/falseoracle:x:818:819::/home/oracle:/bin/bashinfa:x:819:821::/home/infa:/bin/bashzabbix:x:477:472:zabbix monitoring System:/var/lib/zabbix:/sbin/nologin
(2), delete only the second line
[[email protected] shell]# cat passwd | sed ' 2d ' root:x:0:0:root:/root:/bin/ bashdaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/ sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/ Sbin/haltmail:x:8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator : x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x:13:30:gopher:/var/ Gopher:/sbin/nologinftp:x:14:50:ftp user:/var/ftp:/sbin/nologinnobody:x:99:99:nobody:/:/sbin/nologindbus: X:81:81:system message bus:/:/sbin/nologinusbmuxd:x:113:113:usbmuxd user:/:/sbin/nologinrpc:x : 32:32:rpcbind daemon:/var/cache/rpcbind:/sbin/nologinoprofile:x:16:16:special user account to be used by oprofile:/home/oprofile:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrtkit:x:499:497:realtimekit:/proc:/sbin/nologinabrt:x:173:173::/etc/abrt:/sbin/ nologinhsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologinavahi-autoipd:x:170:170:avahi ipv4ll stack:/var/ lib/avahi-autoipd:/sbin/nologinapache:x:48:48:apache:/var/www:/sbin/nologinsaslauth:x:498:76: "Saslauthd User ":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29:rpc service user:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:anonymous nfs user:/var/ lib/nfs:/sbin/nologinhaldaemon:x:68:68:hal daemon:/:/sbin/nologingdm:x:42:42::/var/lib/gdm:/sbin/ nologinntp:x:38:38::/etc/ntp:/sbin/nologinpulse:x:497:495:pulseaudio system daemon:/var/run/pulse:/ Sbin/nologinwebalizer:x:67:67:webalizer:/var/www/usage:/sbin/nologinsshd:x:74:74:privilege-separated ssh :/var/empty/sshd:/sbin/nologintcpdump:x:72:72::/:/sbin/nologinuserlog:x:816:816::/home/userlog:/bin/bashtomcat : X:815:815::/home/tomcat:/bin/bashmanager:x:817:817::/home/manager:/bin/bashcloudera-scm:x:496:492:cloudera manager:/var/lib/ cloudera-scm-server:/sbin/nologinflume:x:495:490:flume:/var/lib/flume-ng:/bin/falsehdfs:x:494:489:hadoop hdfs:/var/lib/hadoop-hdfs:/bin/bashsolr:x:493:488:solr:/var/lib/solr:/sbin/nologinzookeeper:x:492:487: Zookeeper:/var/lib/zookeeper:/bin/falsellama:x:491:486:llama:/var/lib/llama:/bin/bashhttpfs:x:490:485:hadoop httpfs:/var/lib/hadoop-httpfs:/bin/bashmapred:x:489:484:hadoop mapreduce:/var/lib/hadoop-mapreduce :/bin/bashsqoop:x:488:483:sqoop:/var/lib/sqoop:/bin/falseyarn:x:487:482:hadoop yarn:/var/lib/hadoop-yarn :/bin/bashkms:x:486:481:hadoop kms:/var/lib/hadoop-kms:/bin/bashhive:x:485:480:hive:/var/lib/hive:/bin/ Falsesqoop2:x:484:479:sqoop 2 user:/var/lib/sqoop2:/sbin/nologinoozie:x:483:478:oozie user:/var /lib/oozie:/bin/falsehbase:x:482:477:hbase:/var/lib/hbase:/bin/falsesentry:x:481:476:sentry:/var/lib/sentry:/ sbin/nologinimpala:x:480:475:impala:/var/lib/impala:/bin/bashspark:x:479:474:spark:/var/lib/spark:/sbin/nologinhue:x:478:473:hue:/usr/lib/hue:/bin/ falseoracle:x:818:819::/home/oracle:/bin/bashinfa:x:819:821::/home/infa:/bin/bashzabbix:x:477:472:zabbix Monitoring system:/var/lib/zabbix:/sbin/nologin
(3), delete only 3rd line to last sed ' 3, $d '
[email protected] shell]# Cat passwd | Sed ' 3, $d ' Root:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologin
(4), after the second line (that is, add in the third line) plus "I am a good boy" words! Just use 2i to do it.
Cat passwd | Sed ' 2i I am a good boy '
[Email protected] shell]# head-5 passwd | Sed ' 2i I am a good boy ' Root:x:0:0:root:/root:/bin/bashi am a good Boybin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemo N:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
(5) To add more than two lines
For example, the second row and the third row add the respective AAAA bbbb
Each row must be added with a backslash [\] To add a new line!
[Email protected] shell]# head-10 passwd | Sed ' 2a aaaaa> bbbb ' root:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologinaaaaabbbb daemon:x:2:2: Daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x : 5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x : 8:12:mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
2. Substitution and display of behavior units
(1), replace the content of 2–5 line as [AAAA]?
Head-8/etc/passwd | Sed ' 2,5c aaaa '
[Email protected] shell]# head-8/etc/passwd | Sed ' 2,5c aaaa ' root:x:0:0:root:/root:/bin/bashaaaasync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/ Sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/halt
[Email protected] shell]# head-8/etc/passwd | Sed ' 2,4c aaaa ' root:x:0:0:root:/root:/bin/bashaaaalp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin :/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/halt
In this way, we can replace the entire line of data.!!!!!!!!
(2) List the 第5-7 lines in the/etc/passwd file
Head-10 passwd | Sed-n ' 5,7p '
[Email protected] shell]# head-10 passwd | Sed-n ' 5,7p ' lp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/ Sbin:/sbin/shutdown
Conclusion: The display function of SED is able to select some line numbers in a certain file.
3, the data search and display
Search for a line with the root keyword/etc/passwd
(1) No parameters (except output all rows, and also output matching rows)
[[email protected] shell]# cat passwd | sed '/root/p ' root:x:0:0 : Root:/root:/bin/bashroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin :/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/ sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/ var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologinoperator:x:11:0:operator:/root:/ Sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologingames:x:12:100:games:/usr/games:/sbin/nologingopher:x : 13:30:gopher:/var/gopher:/sbin/nologinftp:x:14:50:ftp user:/var/ftp:/sbin/nologinnobody:x:99:99:nobody:/ :/sbin/nologindbus:x:81:81:system message bus:/:/sbin/nologinusbmuxd:x:113:113:usbmuxd user:/:/ Sbin/nologinrpc:x:32:32:rpcbind daemon:/var/cache/rpcbind:/sbin/nologinoprofile:x:16:16:special user account to be used by oprofile:/home/oprofile:/sbin/nologinvcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologinrtkit:x:499:497:realtimekit:/proc:/sbin/nologinabrt:x:173:173::/etc/abrt:/ Sbin/nologinhsqldb:x:96:96::/var/lib/hsqldb:/sbin/nologinavahi-autoipd:x:170:170:avahi ipv4ll stack :/var/lib/avahi-autoipd:/sbin/nologinapache:x:48:48:apache:/var/www:/sbin/nologinsaslauth:x:498:76: "Saslauthd user ":/var/empty/saslauth:/sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinrpcuser:x:29:29: Rpc service user:/var/lib/nfs:/sbin/nologinnfsnobody:x:65534:65534:anonymous nfs user:/var /lib/nfs:/sbin/nologinhaldaemon:x:68:68:hal daemon:/:/sbin/nologingdm:x:42:42::/var/lib/gdm:/sbin/ nologinntp:x:38:38::/etc/ntp:/sbin/nologinpulse:x:497:495:pulseaudio system daemon:/var/run/pulse:/ Sbin/nologinwebalizer:x:67:67:webalizer:/var/www/usage:/sbin/nologinsshd:x:74:74:privilege-separated ssh :/var/empty/sshd:/sbin/nologintcpdump:x:72:72::/:/sbin/nologinuserlog:x:816:816::/home/userlog:/bin/bashtomcat:x:815:815::/home/ tomcat:/bin/bashmanager:x:817:817::/home/manager:/bin/bashcloudera-scm:x:496:492:cloudera manager:/var/ Lib/cloudera-scm-server:/sbin/nologinflume:x:495:490:flume:/var/lib/flume-ng:/bin/falsehdfs:x:494:489:hadoop hdfs:/var/lib/hadoop-hdfs:/bin/bashsolr:x:493:488:solr:/var/lib/solr:/sbin/nologinzookeeper:x:492:487: Zookeeper:/var/lib/zookeeper:/bin/falsellama:x:491:486:llama:/var/lib/llama:/bin/bashhttpfs:x:490:485:hadoop httpfs:/var/lib/hadoop-httpfs:/bin/bashmapred:x:489:484:hadoop mapreduce:/var/lib/hadoop-mapreduce :/bin/bashsqoop:x:488:483:sqoop:/var/lib/sqoop:/bin/falseyarn:x:487:482:hadoop yarn:/var/lib/hadoop-yarn :/bin/bashkms:x:486:481:hadoop kms:/var/lib/hadoop-kms:/bin/bashhive:x:485:480:hive:/var/lib/hive:/bin/ Falsesqoop2:x:484:479:sqoop 2 user:/var/lib/sqoop2:/sbin/nologinoozie:x:483:478:oozie user:/var /lib/oozie:/bin/falsehbase: x:482:477:hbase:/var/lib/hbase:/bin/falsesentry:x:481:476:sentry:/var/lib/sentry:/sbin/nologinimpala:x : 480:475:impala:/var/lib/impala:/bin/bashspark:x:479:474:spark:/var/lib/spark:/sbin/nologinhue:x:478:473:hue:/ Usr/lib/hue:/bin/falseoracle:x:818:819::/home/oracle:/bin/bashinfa:x:819:821::/home/infa:/bin/bashzabbix:x : 477:472:zabbix monitoring system:/var/lib/zabbix:/sbin/nologin
(2), followed by a parameter-n
Output only Hadoop-matched rows
Cat passwd | Sed-n '/hadoop/p '
[email protected] shell]# Cat passwd | Sed-n '/hadoop/p ' Hdfs:x:494:489:hadoop hdfs:/var/lib/hadoop-hdfs:/bin/bashhttpfs:x:490:485:hadoop HTTPFS:/var/lib /hadoop-httpfs:/bin/bashmapred:x:489:484:hadoop mapreduce:/var/lib/hadoop-mapreduce:/bin/bashyarn:x:487:482: Hadoop Yarn:/var/lib/hadoop-yarn:/bin/bashkms:x:486:481:hadoop Kms:/var/lib/hadoop-kms:/bin/bash
[email protected] shell]# Cat passwd | Sed-n '/root/p ' Root:x:0:0:root:/root:/bin/bashoperator:x:11:0:operator:/root:/sbin/nologin
4, the data search and delete
For example, delete the row where root is located
Cat passwd | Sed '/root/d ' >> a.txt
[email protected] shell]# Cat passwd | Sed '/root/d ' >> a.txt[[email protected] shell]# head a.txt Bin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon :/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0: Sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12: mail:/var/spool/mail:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologingames:x:12:100:games:/usr/ Games:/sbin/nologin
Look at the result, the root row was deleted!!!
5, multi-point editing
An sed command that removes data from the third line to the end of/etc/passwd and replaces bash with Blueshell
Cat passwd | Sed-e ' 3, $d '-e ' s/bash/blueshell/'
[email protected] shell]# Cat passwd | Sed-e ' 3, $d '-e ' s/bash/blueshell/' Root:x:0:0:root:/root:/bin/blueshellbin:x:1:1:bin:/bin:/sbin/nologin
6. Search and replace data
After finishing!!!!!!!!!!!!!!
This article is from the "Liang blog" blog, make sure to keep this source http://7038006.blog.51cto.com/7028006/1825682
Linux sed usage