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

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

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -