Date: Thu, 21 Jul 2016 08:00:44 -0400
From: bruce <badouglas@xxxxxxxxx>
Subject: sed question
Hey guys..
Sed question.. should be simple, but after stack/net searches, lots or
trials.. can't seem to get it..
I've got a case
any thoughts on how to handle the parens would be cool!
just irks me that I couldn't see what I missed.
You cannot 'escape' the parens since '\(' and '\)' are defined 'codes'
like ^ & and $.
\( marks the start of an internal variable to be recorded, and \) marks
the end, substitution in the output side uses \1 (or \2,\3, or as many
as needed)
So sed -i -e "s#('txt')#'(\/dir\/txt)'#g" foo
should work.
NOTE: 1) sed inplace replacement
2) using extended grep
3) for clarity, the usual use of '/' for the 's' replacement is changed
to '#'
4) the global replacement marker, usually ', is changed to "
sed gets confused when dealing with mixed ' and " markers, I suspect
that this is your problem. So use the opposite marker outside the sed
replacement, when you have one inside.
--
R. Geoffrey Newbury
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://lists.fedoraproject.org/admin/lists/users@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org