regex - awk: comment a SQL statement -


i have huge file lines like

insert mytable (),()... 

i'd replace lines beginning insert mytable by

/* insert mytable (),()... */ 

i know there tons of possibilities, including vim search replace macro, i'd in command line.

here's awk version:

 awk '{ gsub("^(insert.*)","/* & */"); print $0 }' 

this assuming insert first character on line. if there can leading spaces, use instead:

awk '{ gsub("^([[:space:]]*insert.*)","/* & */"); print $0 }' 

this should work non-gnu awk's well. tested on linux , aix.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -