简体   繁体   中英

Ways to find records based on their first letter awk Unix using variable

awk -F":" -v var="$letterinput" '$3 ~ /^$var/{printf"%-s\n",$3}' NSN_DATA

this is what i have come up with so far. I can get it to work with switch out ^var with ^A but i need it to allow the user to set letter.

改成

awk -F: -v var="$letterinput" '$3 ~ "^"var {printf"%-s\n",$3}' NSN_DATA

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM