You need to quote the RT1002 string I think:
Code:
$ awk -F "," '$1 == "R1002" {print "Name: ", $2, "\n", "Number: ", $3}' clients.txt
Name: Szymon Mackenzie
Number: 6716001426
$
You can pass variables in using the -v command line switch:
Code:
$ awk -F "," -v id="R1002" '$1 == id {print "Name: ", $2, "\n", "Number: ", $3}' clients.txt
Name: Szymon Mackenzie
Number: 6716001426
$ awk -F "," -v id="F1005" '$1 == id {print "Name: ", $2, "\n", "Number: ", $3}' clients.txt
Name: Rohan Munro
Number: 6757315398
$
Bookmarks