Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Issue with grep

Shell Programming and Scripting


Tags
grep based on pattern

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-21-2013
yadavricky yadavricky is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 20 April 2015, 7:17 AM EDT
Posts: 51
Thanks: 24
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 Unix and Linux 02-21-2013
balapobi balapobi is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 24 April 2015, 3:00 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 07:44 AM.