Linux awk command execution ways:
1. Command line execution
➜ awk -F" " '{print $2}' test.txt
Detailed introduction of syntax, see 《Linux awk》
2. Shell script file execution
➜ vim test1.awk
#!/usr/bin/awk -f
{
print $2
}
➜ ./test1.awk test.txt
Explanation:
!/usr/bin/awk
The first line of #!/usr/bin/awk is the awk command location.
use : ➜ which awk /usr/bin/awk
3. Awk script file execution
➜ vim test.awk
{print $2}
➜ awk -f test.awk test.txt