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

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -

javascript - Using jquery append to add option values into a select element not working -

javascript - Restarting Supervisor and effect on FlaskSocketIO -