11/11 Argh. Why isn't this working?
perl -p -i.bak -e 's#\n\n#\n#gsm' foo.cc
I've got to change
/* comment */
int
TO
/* comment */
int
\_ man perlrun, and look at the explanation of -p. --scotsman
\_ s/^\n// worked for me. and no emacs needed.
\- you can use an emacs kbdmacro, then use the macro2elisp
"complier" and then tweak the function to do this.
there might be a simpler way to do this with
query-replace* ... depends on the exact details. --psb
\_ I wound up doing s/\n/FOOBAR/g; s/FOOBARFOOBARint/FOOBARint/g;
s/FOOBAR/\n/g; . That's it. Fuck this, I'm leaving. And
thanks for the suggestions.
\_ The reason it didn't work is b/c -p only gets one line at a time,
so the entire string you get to match is, for instance,
"/* comment */\n", not the 3 lines you were looking for.
Getting rid of the \n's first let you have it all on one line.
\_ perl -p -i.bak -e 's#^\n##' foo.cc |