The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 08-26-2007
steveglevin steveglevin is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
Thanks for this...

Not sure i was very clear before, the text I need to replace has the last two letters vary so I can't specificaly request a change on a specific set of characters like 'CR'.

The text string I need to replace is made up of varying 3 digits and then 2 letters like:

000XX

But I need to remove the two letters in each instance but preserve the rest of the text around the string as in the example:

<image file="STRAIGHT_000XX.jpg" ALT="STRAIGHT_000XX.jpg" />

needs to look like:

<image file="STRAIGHT_000.jpg" ALT="STRAIGHT_000.jpg" />

I am using a text editing program to do this which supports GREP find and replace so need to know the GREP search query string which I think is _\d{3}\D\D and then the Replacement string which will remove the two letters at the end of the text which it finds...

Sorry to be a pain...

Thanks.