Simple regular expressions using vim or sed did not work since they all deal with a single line, but each one of them provide a mechanism to match regular expression over multiple lines.
sed - the following command will extract all lines between a 'select' and the first ';' following that. Hence you would have printed all the sql queries from a file
sed -ne '/^select/,/;/p' SqlIntensiveFile.java
vim - using the 'g' command can achieve the same. For e.g. the following will delete all the sql queries from the file.
%g/select/,/;/d
No comments:
Post a Comment