Hi all,
I'm having writer's block (must be Fri. 13th)
Trying to write a basic sed substitution:
A relevant chunk of file looks like this:
The problem is I do not want substrings replaced. I only want HTR4B.L replaced with HTR2.L and LC_HTR4B.SDCS would remain unchanged.
This is the result I want:
These are C++ objects in an XML file. So that means they must start with a letter or underscore and can contain letters, digits and underscores. Our system forces uppercase.
So I thought this might work but it doesn't:
This is probably an easy one for you regular expression wizards!
Thanks,
CraigMan >
:O>
I'm having writer's block (must be Fri. 13th)
Trying to write a basic sed substitution:
Code:
sed "s/HTR4B/HTR2/g" file
A relevant chunk of file looks like this:
Code:
<PRM_ASSN>HTR4B.L</PRM_ASSN>
<GMBE_NAME>LC_HTR4B.SDCS = PROC</GMBE_NAME>
The problem is I do not want substrings replaced. I only want HTR4B.L replaced with HTR2.L and LC_HTR4B.SDCS would remain unchanged.
This is the result I want:
Code:
<PRM_ASSN>HTR2.L</PRM_ASSN>
<GMBE_NAME>LC_HTR4B.SDCS = PROC</GMBE_NAME>
These are C++ objects in an XML file. So that means they must start with a letter or underscore and can contain letters, digits and underscores. Our system forces uppercase.
So I thought this might work but it doesn't:
Code:
sed "s/(![_A-Z0-9])HTR4B(![_A-Z0-9.])/HTR2/g" file
This is probably an easy one for you regular expression wizards!
Thanks,
CraigMan >