Using shell variables with awk.
1. awk "/$func/"'{print $0}' filename
2. awk -v pat=$func '/pat/{print $0}' filename
Using fields in search pattern
For a similar match:
1. awk '$1~/pattern/{print $0}' filename
For a precise match:
2. awk -F":" -v user=$U '$1 == user {print $0}' filename
No comments:
Post a Comment