I have this source file.c:
#include <dir/header1>
#include <dir/header2>
#include <dir/header3>
...
I would like to match only those headers after dir, (e.g. header1
). I do this:
$ sed -En 's/\/(.*)>/\1/p' file.c
but the will output:
#include <dirheader1
, so it matched from the beginning of line, But I wanted to group from /
character (therefor s/\/...
). So I have tried:
$ sed -En 's/<.*\/(.*)>/\1/p' file.c
Neither that helped. So how to achieve that?