Results 1 to 2 of 2
i'm trying to convert this awk command from command line into an awk script, but just cannot get it to work:
awk -F: '$5 ~ /A/ {Acount++; print Acount}' file
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-15-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 3
awk script help
i'm trying to convert this awk command from command line into an awk script, but just cannot get it to work:
awk -F: '$5 ~ /A/ {Acount++; print Acount}' file
this is what i have after my BEGIN
$5~/A/Acount++ {print Acount}
am i missing something here? this just prints out the count for everyline, not counting lines on 5th field that match 'A'
any help is appreciated.
- 10-15-2010 #2
Your script should look like this:
And you should invoke it like this:Code:/path/to/awk -f BEGIN { FS = ":" } $5 ~ /A/ { Acount++ } END { print Account }
Code:awk -f <script_name> <input_filename>


Reply With Quote
