list of unmatched columns


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting list of unmatched columns
# 1  
Old 12-12-2007
list of unmatched columns

Hi ,
I have two files want to compare and list of column values and postion which are not matched between two files,I can use diff but it will return rows from two files which are matched and unmatched columns.I wrote the below script but not working.

f1=$1
f2=$2
for i in 1
do
file1=`cat $f1 |awk -v col=$i '{print $col}'`
file2=`cat $f2 |awk -v col=$i '{print $col}'`
if [ "$file1" != "$file2" ] ; then
echo $i ":" $file1 ":" $file2 ":"
else
echo "records are matches"
fi
done

Thanks and Regards,
MR
# 2  
Old 12-12-2007
Buddy....

I couldn't really understand ur prob....Can you please give me an example...
Probably I cud be of some help to you...

Bye...
# 3  
Old 12-12-2007
Hi.

To help explain the problem, post samples of the files, and desired output. Please use code blocks to allow easy reading, like this:
Code:
f1=$1
f2=$2
for i in 1
do
...

Best wishes ... cheers, drl
# 4  
Old 12-12-2007
Hi ,
Sorry for not proper explanation .



Example
file1 : 100 xyz cc
file 2: 100 yzc zz

xyz is column position is 2 and cc is 3 in file1
yzc is colimn position is 2 and zz is 3 in file2 as well

When compating ,o/p should be


2:3: xyz :cc
2:3: yzc :zz


Thanks and Regards,
MR
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Portable way to print list in columns

so if i have a list of file names, on linux system, we can use the column command to split them up into columns. sadly, the "columns" command does not exist on some OSes. so i found that the pr command can also work. but, pr tends to truncate the names. There's a way around that on... (3 Replies)
Discussion started by: SkySmart
3 Replies

2. Shell Programming and Scripting

<< unmatched error

Hi all, I want to call a plsql package that does not return any value. I am using the following script to do so: sqlplus $UserNamePwd <<EOF set head off begin test_pkg.procedure('$DebugFlag'); end; exit EOF if then log_message "procedure failed." exit 1 fi exit $? I... (2 Replies)
Discussion started by: reshma15193
2 Replies

3. Shell Programming and Scripting

Retain the unmatched columns while joining

I have 2 files file1 id city car type model 1 york subaru impreza king 2 kampala toyota corolla sissy 3 luzern chrysler gravity falcon file2 id name rating 3 zanzini PG 2 tara X when i use join sorted_file1 sorted_file2 >output i get something like... (2 Replies)
Discussion started by: anurupa777
2 Replies

4. Shell Programming and Scripting

Unmatched <<

Hi, I am running sinple ksh script . From some reason it failed on the following error: ./ogg_status.sh: syntax error at line 16 : `<<' unmatched Please advise. #!/usr/bin/ksh export ORACLE_HOME=/software/oracle/DB10gR2 export LD_LIBRARY_PATH=/software/oracle/DB10gR2/lib:/usr/lib... (4 Replies)
Discussion started by: yoavbe
4 Replies

5. UNIX for Dummies Questions & Answers

Creating columns from a list

I have a list below, how can I have things separated nicely in columns mv browseDir.tcsh browseDir.csh mv checkSRDist.tcsh checkSRDist.csh mv create-data-tinv.tcsh create-data-tinv.csh mv createDocs.tcsh createDocs.csh mv createMisfit.tcsh createMisfit.csh mv createModel.tcsh... (4 Replies)
Discussion started by: kristinu
4 Replies

6. Shell Programming and Scripting

Deleting columns by list or file

Dear specialists out there, please help a poor awk newbie: I have a very huge file to process consisting of 300000 columns and 1500 rows. About 20000 columns shall be deleted from that file. So it is clear, that I can't do this by writing down all the columns in an awk command like $1, $x etc.... (5 Replies)
Discussion started by: flxms
5 Replies

7. Shell Programming and Scripting

`for' unmatched

:b:Hi guys, I am getting this error in this piece of code, Any help will be appreciate rypidoc.shl: syntax error at line 79 : `for' unmatched ##Determine if there is a file to process ls 3526*.dat > /dev/null 2>&1 if then exit fi for i in 3526*.dat do # Capture just the file... (2 Replies)
Discussion started by: rechever
2 Replies

8. Shell Programming and Scripting

done' unexpected and do' unmatched

Good morning, I have been teaching myself shell scripting and seem to be stuck here. I am sure I am just blind and not seeing it so I thought maybe some fresh eyes would help. With the script below I keep getting.... "syntax error at line 248 : `done' unexpected" I am not seeing why this... (6 Replies)
Discussion started by: LRoberts
6 Replies

9. Shell Programming and Scripting

else unmatched

I'm getting an else unmatched error on the script below.. For info : SYDB is the database name entered as a param on the command line. #Check the DB name HBDB=`sql $SYDB <<_END_ | grep '^|' | grep -v dbase | sed 's/|//g' | sed 's/ //g' set autocommit on; \p\g set lockmode... (7 Replies)
Discussion started by: b.hamilton
7 Replies

10. Shell Programming and Scripting

List to columns and awk help

Hi I'm new to this forum and I'm a beginner when it comes to shell programming and awk programming. But I have the following problem: I've a list like this: 1 2 3 4 5 6 7 8 Either from a file or output from a command. What I would like to do is to arrange these values into x columns... (17 Replies)
Discussion started by: baghera
17 Replies
Login or Register to Ask a Question