awk中可以写方法吗

2025-05-17 21:22:37
推荐回答(1个)
回答1:

可以写啊
#!/bin/sh
awk '
#注意函数括号里面需要打两个空格
function fun_test1( )
{
print "hello world! "
}
BEGIN{
FS="|"
}
{
printf "in awk no Parameter:" $2 " "
#注意调用函数值得带()括号
fun_test1()
}' sourcedata/pcscard.dat