linux-tutorial/codes/shell/示例脚本/查找替换文本/gawk/gawk.sh

20 lines
256 B
Bash
Raw Normal View History

2019-05-10 11:17:57 +08:00
#!/bin/bash
BEGIN {
print "The latest list of users and shells"
print "Userid Shell"
print "------ -----"
FS=":"
}
{
2019-10-10 08:56:31 +08:00
print $1 " " $7
2019-05-10 11:17:57 +08:00
}
END {
print "This concludes the listing"
}
#执行gawk命令截取/etc/passwd输出
#gawk -f gawk.sh /etc/passwd