I’m trying to play with sed, to change all;
#include "X"
to:
#include <X>
However I can’t seem to find a way to do this! – This is what I’ve done so far:
sed -i 's/#include ".*"/#include <.*>/g' filename
I think I’m in need of a variable to save the contains of “.*”, i’m just unaware of how!
Yes, you do. Regexps use () to save the contents of a match and a \1 to retrieve it. If you use more than one set of (), then the 2nd match is in \2 , and so on.
will do what you need.