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
grep -A switch not working correctly with -m zer0 UNIX for Dummies Questions & Answers 2 06-19-2008 06:26 AM
Is grep being used correctly? sai0899 Shell Programming and Scripting 2 04-18-2008 12:03 AM
HP-UX will not boot correctly pantas manik HP-UX 1 05-30-2006 02:51 AM
fixing the error message when grep doesn't finds the pattern. silver123 UNIX for Dummies Questions & Answers 1 03-03-2006 05:59 AM
grep error message gammaman UNIX for Dummies Questions & Answers 3 07-10-2005 11:58 PM

 
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 11-11-2008
SwapnaNaidu SwapnaNaidu is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
Grep/awk not getting the message correctly

I have a script which will take two file as the inputs and take the Value in file1 and search in file2 and give the output in Outputfile.
#!/bin/sh
#. ${HOME}/crossworlds/bin/CWSharedEnv.sh
FILE1=$1
FILE2=$2
for Var in $(cat $FILE1);do
echo $Var
grep -i "$Var" $FILE2
done > Outputfile

I have tried awk "/$Var/" $FILE2 instead of grep -i "$Var" $FILE2.But gives the same results.

My File2 contains lines with Japanese characters.

But the problem here is the Outfputile shows some lines with 1004 bytes and some lines correctly.
For more clarity I have attached the files FILE1,FILE2 and Outputfile.

To view the Japanese characters correctly you have to use texpad that is Unicode enabled and rightclick and goto properties change the font to unicode japanese.
For the same lines length in File1 is different from Outputfile.
Can anyone explain me what is the problem here and the solution for the same?
Attached Files
File Type: txt FILE1.txt (22 Bytes, 18 views)
File Type: txt File2.txt (62.3 KB, 24 views)
File Type: txt Outputfile.txt (19.0 KB, 12 views)
 

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