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
Regular Expressions HELP - PERL maxmave UNIX for Dummies Questions & Answers 1 06-04-2008 01:15 PM
regular expressions jack1981 Shell Programming and Scripting 4 07-12-2006 04:10 PM
Regular Expressions sandeep_hi Shell Programming and Scripting 6 06-12-2006 03:12 AM
Perl regular expressions... DrRo183 Shell Programming and Scripting 1 04-26-2006 10:28 PM
Regular expressions in sed mfreemantle UNIX for Dummies Questions & Answers 3 02-11-2002 09:34 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 06-04-2008
maxmave maxmave is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 21
Regular Expressions HELP - PERL

Hello,

Code:
$line=USING (FILE '/TEST1/FILENAME'5000)
I want to reterive the value between ' and ) which is 5000 here.

i have tried out the following expressions ...

Type 1 : $Var1=`sed -e 's/.*\' //' -e 's\).*$/' $line`;
Type 2 : $Var1=`echo $line | awk -F"\'" '{print $2}' | awk -F"\\)" '{print $1}'`;
Type 3 : $Var1=`echo $line | sed 's/.*\' //' | sed 's/\).*$//'`;
Type 4 : $Var1=`echo $line | sed 's/.*\' //' | sed 's/\)$//'`;
Type 5 : $Var1=`echo $line | sed 's/.*File //' | sed 's/Closing.*$//'`;
Type 6 : $Var1=`echo $line | sed 's/"//g' | sed 's/\)//g' | awk -F"\'" '{print $2}'`;
Type 7 : $Var1=`sed 's/.*'\(.*\)).*/\1/' $line`;

but nothing is working out, i am always getting an error saying that
Code:
sh: -c: line 0: syntax error near unexpected token `('
Any Suggestions will be helpful

Thanks

Rahul

Last edited by Yogesh Sawant; 06-05-2008 at 04:56 AM.. Reason: added code tags
 

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 01:19 PM.


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