![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What the command to find out the record length of a fixed length file? | tranq01 | UNIX for Dummies Questions & Answers | 9 | 12-04-2008 04:04 PM |
| Help with Fixed width File Parsing | sate911 | UNIX Desktop for Dummies Questions & Answers | 4 | 05-19-2008 12:18 PM |
| Changing particular field in fixed width file | dsravan | Shell Programming and Scripting | 4 | 02-11-2008 06:08 PM |
| Fixed Width file using AWK | alok.benjwal | UNIX for Dummies Questions & Answers | 2 | 12-05-2005 11:39 AM |
| creating a fixed length output from a variable length input | r1500 | Shell Programming and Scripting | 2 | 12-03-2003 01:09 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Combining Two fixed width columns to a variable length file
Hi, I have two files.
File1: File1 contains two fixed width columns ID of 15 characters length and Name is of 100 characters length. ID Name 1-43<<11 spaces>>Swapna<<94 spaces>> 1-234<<10 spaces>>Mani<<96 spaces>> 1-3456<<9 spaces>>Kapil<<95 spaces>> File2: File2 contains two fixed width columns ID of 15 characters length and Name is of 80 characters length. ID Place 1-3456<<10 spaces>>Boston<<74 spaces>> 1-43<<11 spaces>>London<<74spaces>> I need an output file of variable length file as follows Output: The Output file should contain the matched records of both File1 and File2 based on ID column. Id Name 1-43<<1 space>>Swapna 1-234 1-3456<<1 space>>Kapil Thanks in Advance. |
|
||||
|
Thanks for the reply......I have tried by giving the command...............
awk 'NR==FNR{a[$1]=$2;next}{print $1, a[$1]}' File1 File2 or nawk 'NR==FNR{a[$1]=$2;next}{print $1, a[$1]}' File1 File2 But Iam getting the output as Id Name 1-43<<1 space>>Swapna 1-3456<<1 space>>Kapil But I need output as Id Name 1-43<<1 space>>Swapna 1-234 1-3456<<1 space>>Kapil |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|