Reputation:
I want to replace with "sed" a string containing parenthesis with a part of the contained string into the parenthesis.
Input
to_date('04/10/12','DD/MM/RR')
Output
'04/10/12'
Is it possible? How?
Multiple occurrences can exist in the input
I tried
sed -e 's/to_date(//'' -e 's/,\'DD/MM/RR\')//g'
but I would like a one substitute expression
Upvotes: 1
Views: 658
Reputation: 2471
You can use this sed too
sed -E "s/[^']*('[^']*').*/\1/" <<< "to_date('04/10/12','DD/MM/RR')"
Upvotes: 0
Reputation: 785098
You can use this sed
:
sed -E "s/to_date\(('[^']+')[^)]*\)/\1/g" <<< "to_date('04/10/12','DD/MM/RR')"
'04/10/12'
Upvotes: 2