Home awk
Post
Cancel

awk

Specify input file delimiter with -F;

1
cat inputfile.csv | awk -F, '{print "this is the first field:"$1}'

this is the first field:South Africa`

write apostrophes out by escaping and wrapping in quotes ‘\’’;

1
2
3
cat inputfile.csv | awk -F, '{print "insert into SALES_PRODUCTTYPE (TYPECODE) values ('\''"$2"'\'')"}'

insert into SALES_PRODUCTTYPE (TYPECODE) values ('Camping')
This post is licensed under CC BY 4.0 by the author.