Quote:
Originally Posted by steveglevin
Hi,
I really need some help with GREP searching...
I need to find all occurances of a file reference and remove two characters from the end of the reference. For example, here are a few lines showing the text:
<image file="STRAIGHT_004CR.jpg" ALT="STRAIGHT_004CR.jpg" />
<image file="STRAIGHT_006CR.jpg" ALT="STRAIGHT_006CR.jpg" />
<image file="STRAIGHT_007CR.jpg" ALT="STRAIGHT_007CR.jpg" />
And they then need to look like:
<image file="STRAIGHT_004.jpg" ALT="STRAIGHT_004.jpg" />
<image file="STRAIGHT_006.jpg" ALT="STRAIGHT_006.jpg" />
<image file="STRAIGHT_007.jpg" ALT="STRAIGHT_007.jpg" />
I think I've written the correct search query which I think is:
_\d{3}\D\D
But I have no idea how to write the replacement string to remove the additional letters at the end of the string of 3 numbers and leave everything else in tact...
ANy help would be much appreciated...
Thanks
Steve.
|
Hi,
try using :
sed.
sed 's/CR.jpg/.jpg/g'
But make sure you have a backup of the file.
regards