I'm trying to change the directory of all C headers like #include "library.h" to #include "prefix/library.h" in a file using the sed command, but I can't figure out how to add a prefix to the middle of a string. So far I've tried this command:
sed -i "s"\/'#include[[:space:]]*[<"][^>"]*[>"]'\/"$prefix"\/ $filename
but it replaces the whole string instead of creating #include "prefix/library.h". Is there any way to change it while keeping the original #include, <, " and spacing?