Friday, February 13, 2015

Awk script to read and write to file

Awk script to read from a file and format the string and write the out in another file.

Input file

ABC;def;ghi;jkl
Mno;pqr;stu;vwx

Awk script

#!/bin/ksh

FILENAME= $1

awk 'BEGIN {FS=";"} {printf " update table set column= '\''%s'\'' where column= something \n" , $2 > "output file.txt"} ' $FILENAME

…..............

Run script
Scriptname inputfilename

No comments:

Post a Comment