I am trying to run a shell command from within awk for each line of a file, and the shell command needs one input argument. I tried to use system()
, but it didn't recognize the input argument.
Each line of this file is an address of a file, and I want to run a command to process that file. So, for a simple example I want to use 'wc' command for each line and pass $1
to wc.
awk '{system("wc $1")}' myfile
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…