GutiMac GutiMac - 5 months ago 14
Bash Question

Replace a String with a substring of the first one

I am looking for a sed command or even with node replace a way to do this:

file.txt:

....
ISODate("Something inside"),
....
ISODate("Other thing"),
....


Pass sed command or a node command to file.txt and the output would be:

....
"Something inside",
....
"Other thing",
....


I am trying to use regexp in replace but I can't remove the last ')'.

Any idea??

Thanks in advaned.

Answer

As for you exmaple:

sed "s/^\(.*\)ISODate(\(.*\))\(.*\)$/\1\2\3/g" file.txt