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
escaping special characters in file name... lau0001 Shell Programming and Scripting 1 01-19-2008 08:54 PM
Removing special characters in file srivsn Shell Programming and Scripting 6 01-03-2008 06:10 AM
How to delete a file with special characters yveslagace UNIX for Dummies Questions & Answers 5 08-22-2007 11:42 AM
how to see special characters in a file using vi jingi1234 UNIX for Dummies Questions & Answers 6 10-19-2005 11:57 AM
search special characters in a file cramya80 UNIX for Dummies Questions & Answers 2 05-13-2005 12:08 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-25-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
UrgentPlease: compare 1 value with file values eliminating special characters

Hi All,

I have file

i have values like
----
112
113
109
112
109

I have another file
cat supplierDetails.txt
-------------------------
112|MIMUS|krishnaveni@google.com
113|MIMIRE|krishnaveni@google.com
114|MIMCHN|krishnaveni@google.com
115|CEL|krishnaveni@google.com
108|UGEN|krishnaveni@google.com
109|SLAND|krishnaveni@google.com



I need to compare above values to this file first column values
like
if 112=112 then
i need to print MIMUS
like i need to validate above all values to this file,
I need it in loop

Please help me


Thanks
Krish.
  #2 (permalink)  
Old 04-25-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,293
Code:
awk -F"|" 'NR==FNR{arr[$0];next}$1 in arr{print $2}' file1 upplierDetails.txt
Regards
  #3 (permalink)  
Old 04-25-2008
Shivdatta Shivdatta is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 73
Code:
for val in `cat file1`
do
grep $val supplierList.txt | awk -F"|" '{print $1,$2}' 
done
  #4 (permalink)  
Old 04-25-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
Hi,

Once i got the values
i need to mail this result like
mail -s "Gateway messaging: $2" krish@google.com

is it possible

please answer it.

Thanks krish.
  #5 (permalink)  
Old 04-25-2008
Shivdatta Shivdatta is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 73
U can redirect the printed values to a file
i.e
Code:
grep $val file2 | awk -F"|" '{print $1,$2}' >>tempfile
and later use

Code:
mailx  -s "Gateway messaging:" -r  krish@google.com < tempfile
  #6 (permalink)  
Old 04-25-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
i used mailx is not working

again i used this one
mail -s "Gateway : $2" $Email < $tempfile

it says that

exam5.sh: line 4: $tempfile: ambiguous redirect

Is there any other option
  #7 (permalink)  
Old 04-25-2008
kittusri9 kittusri9 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 40
My requirement is
112|MIMUS|krishnaveni@google.com

if val =112
then i need to send mail to
subject:MIMUS mail to Krishnaveni@google.com

is it possible

if val=113
then i need to send mail to
subject=MIMIRE mail to krish@google.com

i need it like this

Can you help me how to do this.

thanks
krish.
Sponsored Links
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 04:01 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