Today’s interesting discovery

If you want to cut the first 9854797 lines of one file, and put them at the beginning of a 3023304 line file, opening them both up in vim and cutting and pasting from one to the other is probably not the most efficient way to do it. It’s been pasting for a while, and my load average is up over 8 and I’m using 1.4Gb of swap.

Maybe I should kill this and figure out how to do it with awk or something.

3 thoughts on “Today’s interesting discovery”

  1. Actually, I ended up doing it with
    sed -n '0,/^From.*2005/p' < old.mbox > new.mbox and then head -n -1 new.mbox because I couldn’t figure out how to make it leave off the last line in sed.

  2. There’s a command line option for vim which tells it not to swap: “-n”.

    Still wouldn’t use it for files of that size, but it can be useful.

Comments are closed.