1.将/etc/passwd第行的最后一段全部改成/bin/bash
cat 1 |sed -n '1,$p' |egrep '.*:' -o |sed 's/$/\bin\/bash/'

2.将/etc/passwd每行前面的用户名,添加到最后一段
如:root:x:0:0:root:/root:/bin/bash
处理后应该为
root:x:0:0:root:/root:/bin/bash:root
cat 1 |sed 's/\(^[a-z-]*\)\(.*\)/&:\1/'


3.一文本内容如下:
192.168.100.2
172.16.5.4
10.101.2.5
133.37.25.21

通过命令将其处理成如下效果(转换到一行,通过逗号隔开,每行内容用单引号引起来):
'192.168.100.2','172.16.5.4','10.101.2.5','133.37.25.21'

cat 2 |sed "s/^\|$/'/g" |tr '\n' ',' |sed 's/,$/\n