1. awk名包含在文件内
[root@nhserver1 08]# cat sample.txt
aaa
bbb
ccc
[root@nhserver1 08]# cat readsample.awk
awk '
{
print
}' sample.txt
[root@nhserver1 08]# ./readsample.awk
aaa
bbb
ccc
2. awk名包含在命令行上
[root@nhserver1 08]# cat sample.txt
aaa
bbb
ccc
[root@nhserver1 08]# cat readsample2.awk
{
print
}
[root@nhserver1 08]# awk -f readsample2.awk sample.txt
aaa
bbb
ccc