GNU/Linux ◆ screen-256color ◆ bash 1186 views

Moving all SQL DROP statements in a file to the top using a Vim macro.

The macro is recorded using:

qq      # Start recording.
/create # Skip top drop statements by searching for the first create statement.
/drop   # Find the next drop statement.
ddggp   # Move it to the top.
q       # Stop recording.

It can then be run many times over using the normal mode command @q.

More by n2liquid

untitled 00:26

by n2liquid

untitled 01:11

by n2liquid

untitled 01:33

by n2liquid

See all