Issue with grep | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

Issue with grep

Shell Programming and Scripting


Tags
grep based on pattern

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-21-2013
yadavricky yadavricky is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 16 October 2014, 8:07 AM EDT
Posts: 43
Thanks: 21
Thanked 0 Times in 0 Posts
RedHat Issue with grep

Dear All,

I am using the grep command..

Code:
bash-3.2$ grep TR2 /mydata/MISE/MAPPLI/USD/mytransfer/_SRY10566_124005.mail | cut -d "/" -f2-|cut -d ":" -f2

The output is

Code:
/my_repo/*/MYOPS/SR123/SRY78623/RDM/RY_USD


Code:
bash-3.2$ abc=$(grep TR2 /mydata/MISE/MAPPLI/USD/mytransfer/_SRY10566_124005.mail | cut -d "/" -f2-|cut -d ":" -f2)

The output is as below

Code:
bash-3.2$ echo $abc
/my_repo/mine001/MYOPS/SR123/SRY78623/RDM/RY_USD  /my_repo/mine001_RO/MYOPS/SR123/SRY78623/RDM/RY_USD

I undeestand that now the grep is not doing grep from mail body instead it doing grep on Directory structure..

Please let me how we can restict in... in second Case...
I dont want the value /my_repo/mine001_RO/MYOPS/SR123/SRY78623/RDM/RY_USD in second grep case

Last edited by Franklin52; 02-21-2013 at 05:47 AM.. Reason: Please use code tags for data and code samples
Sponsored Links
    #2  
Old 02-21-2013
balapobi balapobi is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 16 May 2014, 6:33 AM EDT
Location: Chennai
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Use double quotes


Code:
bash-3.2$ abc=$(grep TR2 /mydata/MISE/MAPPLI/USD/mytransfer/_SRY10566_124005.mail | cut -d "/" -f2-|cut -d ":" -f2)


Code:
#echo -n "abc=$(grep TR2 /mydata/MISE/MAPPLI/USD/mytransfer/_SRY10566_124005.mail | cut -d "/" -f2-|cut -d ":" -f2)"


Last edited by Franklin52; 02-21-2013 at 05:48 AM.. Reason: Please use code tags for data and code samples
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Issue in grep sharad.40216 Shell Programming and Scripting 7 06-28-2012 04:31 PM
Issue with grep digitalviking Shell Programming and Scripting 5 04-12-2012 01:27 PM
Grep issue vee_789 Shell Programming and Scripting 2 01-17-2012 08:11 AM
Grep issue mohtashims UNIX for Dummies Questions & Answers 9 07-28-2011 04:30 PM
Grep Issue revertback Shell Programming and Scripting 7 04-12-2010 01:02 AM



All times are GMT -4. The time now is 01:06 AM.