×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I got this command to work properly using your multiple pattern suggestion (with help from Google):
sed 's|<Tag />|<Tag>Value</Tag>|; s|<Tag></Tag>|<Tag>Value</Tag>|'' file_path
Thanks
-----Original Message-----
From: dlclark@xxxxxxxxxxxxxxxx [mailto:dlclark@xxxxxxxxxxxxxxxx]
Sent: Wednesday, September 19, 2018 11:43 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
Subject: Re: sed & or
"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 09/19/2018
12:24:32 PM:
Can anyone tell me how to get sed to work with an OR pattern match?
If I try the standard pipe character, the command fails. I found on
Google to escape the pipe with a backslash. That command runs, but
the pattern doesn't match.
Here's what I have that works (just one pattern):
sed 's|<Tag />|<Tag>Value</Tag>|' file_path
This command runs but doesn't match either pattern:
sed 's|<Tag />\|<Tag></Tag>|<Tag>Value</Tag>|' file_path
I haven't tried doing an OR in a single pattern. But, the following is what I use to successfully execute more than one pattern at a time. (Variable substitutions are performed before I use the string in
QSH.)
sed -i -e 's|~&1|~&2|g' -e 's|_&1|_&2|g' &path
Sincerely,
Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300
Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331
*********************************************************************************************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary information. If you have received this message in error, please immediately notify the sender and delete and destroy the message and all copies. All unauthorized direct or indirect use or disclosure of this message is strictly prohibited. No right to confidentiality or privilege is waived or lost by any error in transmission.
*********************************************************************************************
As an Amazon Associate we earn from qualifying purchases.