3zecisi3 ... DBA experiences
Thursday, March 8, 2012
Transform comma text file in SQL insert file
From unix prompt:
perl -pi.bak -e "s/,/','/g;s/^/insert into tab\(x,y\) values \('/g;s/$/'\);/" filename.dat
where:
more filename.dat
11111111,1
.........
After change, there will be one backup file of the original file.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment