GutiMac GutiMac - 1 year ago 68
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:


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 Source

As for you exmaple:

sed "s/^\(.*\)ISODate(\(.*\))\(.*\)$/\1\2\3/g" file.txt
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download