Reputation: 1
I want awk to print the line if the first two characters in field 7 are "R ". I tried this command and it didn't work:
cat file.txt | awk -F, '{if($7=="R *") print $0}'
Can anyone help me with this?
Upvotes: 0
Views: 1390
Reputation: 5298
awk -F, '$7 ~ /^[ \t]*R /' file.txt
Assuming data are comma separated.
Upvotes: 0
Reputation: 166
Use the tilde sign and Regular Expressions (words that start with the letter 'R' and second is space)
cat file.txt | awk -F, '{if ($7 ~ /^R /) print $0;}'
Upvotes: 1