comparing column of two different files and print the column from in order of 2nd file

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting comparing column of two different files and print the column from in order of 2nd file
# 15  
Old 08-24-2011
kudos to u bartus Smilie....
u caught it and I got it.....Smilie

my second file was having one extra blank row at the last line.

I corrected it.....and now getting the perfect result.....Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd

hi I have 2 file with more than 10 columns for both 1st file apple,0,0,0...... orange,1,2,3..... mango,2,4,5..... 2nd file apple,2,3,4,5,6,7... orange,2,3,4,5,6,8... watermerlon,2,3,4,5,6,abc... mango,5,6,7,4,6,def.... (1 Reply)
Discussion started by: tententen
1 Replies

2. Shell Programming and Scripting

Need awk or Shell script to compare Column-1 of two different CSV files and print if column-1 matche

Example: I have files in below format file 1: zxc,133, cst,222, File 2 Contains: hxd hcd jws zxc cst File 1 has 50000 lines and file 2 has around 30000 lines : Expected Output has to be : hxd hcd jws (5 Replies)
Discussion started by: TestPractice
5 Replies

3. Shell Programming and Scripting

Locate the files in the first column and copy the files in 2nd column

#cat data.txt file1 folder1 file2 thisforfile2 file3 thisfolderforfile3 lata4 folder4 step 1: create the folder first in column 2 for i in `awk '{print $2}' data.txt` do mkdir /home/data/$i done step 2: locate the files in column1 and stored them into a file for i in... (17 Replies)
Discussion started by: kenshinhimura
17 Replies

4. Linux

Print the 1st column and the value in 2nd or 3rd column if that is different from the values in 1st

I have file that looks like this, DIP-17571N|refseq:NP_651151 DIP-17460N|refseq:NP_511165|uniprotkb:P45890 DIP-17571N|refseq:NP_651151 DIP-19241N|refseq:NP_524261 DIP-19241N|refseq:NP_524261 DIP-17151N|refseq:NP_524316|uniprotkb:O16797 DIP-19588N|refseq:NP_731165 ... (2 Replies)
Discussion started by: Syeda Sumayya
2 Replies

5. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

6. UNIX for Dummies Questions & Answers

Comparing the 2nd column in two different files and printing corresponding 9th columns in new file

Dear Gurus, I am very new to UNIX. I appreciate your help to manage my files. I have 16 files with equal number of columns in it. Each file has 9 columns separated by space. I need to compare the values in the second column of first file and obtain the corresponding value in the 9th column... (12 Replies)
Discussion started by: Unilearn
12 Replies

7. Shell Programming and Scripting

Comparing two files and printing 2nd column if match found

Hi guys, I'm rather new at using UNIX based systems, and when it comes to scripting etc I'm even newer. I have two files which i need to compare. file1: (some random ID's) 451245 451288 136588 784522 file2: (random ID's + e-mail assigned to ID) 123888 451245 ... (21 Replies)
Discussion started by: spirm8
21 Replies

8. Shell Programming and Scripting

Print rows in reverse order if values decrease along the column

Hi, Guys. Please help me to find solution to this problem using shell scripting. I have an INPUT file with 4 columns separated by tab. Each block of records is separated by ----- ----- Sample1 5402 6680 Pattern01 Sample2 2216 2368 Pattern02... (6 Replies)
Discussion started by: sam_2921
6 Replies

9. Shell Programming and Scripting

Writing out 2nd column into one file from multiple files

I have several files that are being generated every 20 minutes. Each file contains 2 columns. The 1st column is Text, 2nd column is Data. I would like to generate one single file from all these files as follows: One instance of 1st column Text, followed by 2nd column Data separated by... (5 Replies)
Discussion started by: subhap
5 Replies

10. Shell Programming and Scripting

How to manipulate first column and reverse the line order in third and fourth column?

How to manipulate first column and reverse the line order in third and fourth column as follws? For example i have a original file like this: file1 0.00000000E+000 -1.17555359E-001 0.00000000E+000 2.00000000E-002 -1.17555359E-001 0.00000000E+000 ... (1 Reply)
Discussion started by: Max Well
1 Replies
Login or Register to Ask a Question
DB2_FIELD_NAME(3)							 1							 DB2_FIELD_NAME(3)

db2_field_name - Returns the name of the column in the result set

string db2_field_name (resource $stmt, mixed $column) DESCRIPTION
Returns the name of the specified column in the result set. PARAMETERS
o $stmt - Specifies a statement resource containing a result set. o $column - Specifies the column in the result set. This can either be an integer representing the 0-indexed position of the column, or a string containing the name of the column. RETURN VALUES
Returns a string containing the name of the specified column. If the specified column does not exist in the result set, db2_field_name(3) returns FALSE. SEE ALSO
db2_field_display_size(3), db2_field_num(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3). PHP Documentation Group DB2_FIELD_NAME(3)