![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to extract columns from a text file | ihot | Shell Programming and Scripting | 16 | 05-05-2008 08:33 PM |
| merging text files | code19 | Shell Programming and Scripting | 8 | 02-13-2008 05:13 AM |
| Extract text in 2 columns of output file. | Danish Shakil | Shell Programming and Scripting | 2 | 10-19-2007 07:03 AM |
| Extracting columns from different files for later merging | kingkong | UNIX for Dummies Questions & Answers | 2 | 11-23-2005 12:21 AM |
| searching text files on specific columns for duplicates | Gerry405 | UNIX for Dummies Questions & Answers | 2 | 08-18-2005 07:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi
i need to select a few columns of two txt files and write it to a new file. there is one common field for both of these files. plz help me in this thanks in advance |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Hi,
Can you explain with an example? Shihab |
|
#3
|
|||
|
|||
|
i have 2 files with columns like :
file 1 x1,y1, z1 file 2 a1,b1,x1,c1,d1,e1 now i want the output as b1,y1,c1,d1 for all the x1 of file1 in x1 of file2 i want to new file to be a merger of file1 and file 2 as explained above |
|
#4
|
||||
|
||||
|
You can use the join command.
The two files (file1 and file2) must be sorted on the common field x1. Code:
join -t , -1 1 -2 3 -o file1 file2 > file 3 -1 1 : join files using field 1 in file 1 -2 3 : join files using field 2 in file 2 -o 2.2,1.2,2.4,2.5 : list of resulting files (filenumber.field,...) Jean-Pierre |
|
#5
|
|||
|
|||
|
Thanks Jean, it worked prefect!!!!
|
|||
| Google The UNIX and Linux Forums |