![]() |
|
|
|
|
|||||||
| 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 |
| Shell script to format a .CSV data | Uday1982 | Shell Programming and Scripting | 8 | 02-04-2008 02:28 AM |
| how to number format a data file without using SED? | Cactus Jack | UNIX for Dummies Questions & Answers | 3 | 01-12-2008 04:47 PM |
| data format from (4.56 0.7) -> 4.6(7) awk?! | ahan | Shell Programming and Scripting | 4 | 05-07-2006 05:53 PM |
| format data | inquirer | Shell Programming and Scripting | 2 | 09-24-2003 03:59 AM |
| backup data with tar and show them | grashuepfer | UNIX for Advanced & Expert Users | 2 | 12-05-2002 03:43 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Want to show data in tabel format
Hello ,
I need help to show data in table format i have 2 files A and B A files contains 2 coulmns $1 $2 Test 34 Test1 35 Test4 78 Test6 89 B file contains 2 coulmns $3 $4 Test 65 Test4 67 Test6 98 The coulmn $1 of A file is equal to $3 of B file . sometimes enteries are missing in the file so i have to first match coulmn $1 and $3 and show enteries like this . I want to show data in tabel format like this $1 $2 $4 Test 34 65 Test1 35 Test4 78 67 Test6 89 98 Waiting to hear from your end Please reply regards dips |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
$ cat f1 Test 34 Test1 35 Test4 78 Test6 89 $ cat f2 x x Test 65 x x Test4 67 x x Test6 98 $ join -a 1 -j1 1 -j2 3 -o 1.1,1.2,2.4 f1 f2 Test 34 65 Test1 35 Test4 78 67 Test6 89 98 |
|
#3
|
|||
|
|||
|
i want to use nawk comand for showing into table format . i will redirect to other file and which will be run in shell script
nawk -f a.awk fileA fileB > output.txt pls help me |
|
#4
|
|||
|
|||
|
sorry ... i have 3 column in each file ...
pls read this .... File A $1 $2 $3 File B $4 $5 $6 where $1,$2 of A file is same as $4 $5 of B file i need output $1 $2 $3 $6 Test ver10 78 55 Test1 ver5 89 77 Test4 ver6 88 Test ver8 77 66 pls do help |
|
#6
|
|||
|
|||
|
I hope this helps
awk 'FNR == NR {a[$1]=$1 $2;b[$1]=$0;next} {print b[$1], $3}' file1 file2
|
|
#7
|
|||
|
|||
|
I missed something in my last post try this
awk 'FNR == NR {a[$1]=$1 $2;b[$1]=$0;next} $1 in a {print b[$1], $3}' file1 file2
|
|||
| Google The UNIX and Linux Forums |