How can I use ":" as an AWK field separator?
If you want to do it programatically, you can use the FS
variable:
echo "1: " | awk 'BEGIN { FS=":" } /1/ { print $1 }'
Note that if you change it in the main loop rather than the BEGIN
loop, it takes affect for the next line read in, since the current line has already been split.
"-F" is a command line argument, not AWK syntax. Try:
echo "1: " | awk -F ":" '/1/ {print $1}'