The UNIX and Linux Forums  


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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
UNIX newbie NEWBIE question! Hanamachi UNIX for Dummies Questions & Answers 4 03-28-2009 04:10 PM
Simple newbie grep question doubleminus UNIX for Dummies Questions & Answers 5 04-06-2008 07:05 PM
grep - searching for a specific string manthasirisha Shell Programming and Scripting 2 01-05-2006 09:24 AM
searching searching tony3101 Shell Programming and Scripting 3 06-04-2004 12:50 PM
searching for { yotoruja Shell Programming and Scripting 4 11-03-2003 10:07 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-26-2007
steveglevin steveglevin is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 3
GREP Searching for a newbie...

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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0