The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Running same script multiple times concurrently... ckhowe Shell Programming and Scripting 4 12-12-2007 06:39 PM
Crons executed multiple times. shorty UNIX for Dummies Questions & Answers 2 03-14-2007 12:05 PM
Trying to read data multiple times coachr Shell Programming and Scripting 1 12-14-2006 08:19 PM
Trying to read data multiple times coachr Shell Programming and Scripting 0 12-06-2006 02:11 PM
Prevent file from being mailed multiple times from a job Sree_2503 Shell Programming and Scripting 2 11-14-2006 12:47 PM

Closed Thread
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
  #1 (permalink)  
Old 04-28-2004
oldtrash oldtrash is offline
Registered User
  
 

Join Date: Jul 2003
Location: india
Posts: 20
matching multiple times in same line

Hi,
I am stuck with pattern matching.

I need to match a particular pattern several times in a same line and replace them.

for ex.,
I need to convert

(abc XY) (bvf ZY) bla bla

to

XY ZY bla bla

I tried..

s/\([a-z]+ (.[A-Z]+)\)/$1/gi

and it works

(abc XY) ZY bla bla

Can someone help me?

Thanks
  #2 (permalink)  
Old 04-28-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,122
sed 's/([a-z]\{3\} \([A-Z]\{2\}\))/\1/g'
  #3 (permalink)  
Old 04-28-2004
oldtrash oldtrash is offline
Registered User
  
 

Join Date: Jul 2003
Location: india
Posts: 20
Thanks Perderabo,

I did this in Perl using

s/\([abc]+ (\w+)\)/$1/g


Thanks again!
Closed Thread

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 09:54 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