Does anyone know how to replace specific words between ()
. So, for example, replace the word and
with or
in between both sets of parentheseis:
(grade='C' and grade='D' and grade='E') and (int_rate>=10 and int_rate<=20) and pub_rec>=0 and term=' 36 months'
This would be:
(grade='C' or grade='D' or grade='E') and (int_rate>=10 or int_rate<=20) and pub_rec>=0 and term=' 36 months'
Really dorky approach:
$ sed 's/and/or/g' INPUT | sed 's/) or (/) and (/' | sed 's/\(.*\)or/\1and/'
(grade='C' or grade='D' or grade='E') and (int_rate>=10 or int_rate<=20) and pub_rec>=0
and term=' 36 months'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With