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
Perl Search and replace entire line insania Shell Programming and Scripting 1 05-22-2008 07:45 PM
Perl: Global Search and replace epi8 Shell Programming and Scripting 3 05-06-2008 04:18 PM
Search and replace in Perl jyoung Shell Programming and Scripting 2 04-22-2008 02:05 PM
search & replace password perl script shellscript22 Shell Programming and Scripting 4 03-25-2008 03:17 PM
Perl: Search for string on line then search and replace text Crypto Shell Programming and Scripting 4 01-04-2008 10:24 AM

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 07-30-2006
umen umen is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 239
perl search and replace pairs

Hello all
im facing some kind of problem i have this string :

functionA() $" "$ functionB("arg1") $" = "$

i will like to replace all the pairs of opening and closing "$" to be something like that

functionA() <#" "#> functionB("arg1") <#" = "#>
i cant of course do is with simple s/\$/<# and i dont want to build complex string parsing function for that , im sure perl have some quick regexp solution , can someone please help me here ?
  #2 (permalink)  
Old 07-30-2006
nathan nathan is offline VIP Member  
Supporter
  
 

Join Date: Jul 2006
Posts: 156
Will this work?

I used 2 regular expressions here. It can probably be done with just one.

Code:
perl -p -e "s/\\$\"/\<\#\"/g;s/\"\\$/\"\#\>/g"
Closed Thread

Bookmarks

Tags
regex, regular expressions

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 07:45 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