replacing a path with sed
- by compie
How can I use sed to replace this line
char * path_list_[1] = { "/some/random/path" };
with this line
char * path_list_[2] = { "lib/foo", "lib/bar" };
in a file named source.c
Notes:
* The path is really random.
* Your solution should only change this line in source.c
* I'm only interested in a sed oneliner.
You can use this Python regex as a starting point:
text = re.sub('static const char \* path_list_\[1\] = \{ "[^"]*" \};',
'static const char * path_list_[2] = { "lib/sun", "lib/matlab" };', text)