There’s a task I perform regularly and it’s always a 2 step process. One of the programs I maintain queries the database and the SQL is a long series of concatenated strings in a Java source file. I copy the query into a text editor and then remove all the quotes and plus characters so I can modify and test it on the database. Ideally SQL would be kept in an SQL file and it would be easier to work with, but in this case I don’t have the liberty of making that modification.
Today I was given a task to extract customer account IDs from a log file. grep came to the rescue, however I was then required to add a fixed offset to each account ID so I could build an SQL query with an IN clause. I could have managed this by piping the output of grep to awk or bc, but I thought I would flex my vim muscle in this case.