Re: sed question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux