Reputation: 33
(declare-const buabor Real)
which I want to replace as
(declare-fun buabor () Real)
can it be done with sed?
I tried
sed 's/(declare-const\s([a-z])\s(Real))/(declare-fun\s\2\(\)\3/)g'
but was not able to get the result any help would be great
Upvotes: 1
Views: 39
Reputation: 23697
This should do (assuming GNU sed
as \s
is used):
sed 's/(declare-const\s\([a-z]*\)/(declare-fun \1()/'
(
and )
will be matched literally in search section. See also BRE-vs-ERE section in the manual\(
and \)
will then become capture group[a-z]*
will match zero or more lowercase alphabetsA few more observations:
(
and )
aren't special in replacement section\s
is again not special in replacement section, will insert s
Upvotes: 1