I am trying to make a simple bash script that uses command line arguments as parameters to awk.
The file format is like this:
id|Name|birthday|joinDate
And the command line input:
./my_script -f filename.dat -id 1234
When I use the following line of code:
awk -v arg ="$4", -F"|" '{if(arg == $1)print $1,$2}' "$2"
I get an error that says:
'awk: 'arg' argument to '-v' not in 'var=value' form'.
What's wrong with this? All I want is to print specific columns of the given ID.