Want to show data in tabel format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Want to show data in tabel format
# 1  
Old 05-04-2006
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
# 2  
Old 05-04-2006
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

Cheers
# 3  
Old 05-04-2006
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  
Old 05-04-2006
Java

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
# 5  
Old 05-04-2006
wasn't an extremely similar question asked and answered here?
# 6  
Old 05-04-2006
I hope this helps

awk 'FNR == NR {a[$1]=$1 $2;b[$1]=$0;next} {print b[$1], $3}' file1 file2
# 7  
Old 05-04-2006
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read info from api website and show retrieved data

good evening, i'm still new in scripting but i'm learning every day and i'm enjoying it. so i have api website (htt p://api.nobelprize.org/v1/prize.json), i want to make a script that allows me to give it two arguments like ./test.sh 2005 physics, 2000 is for the year and physics is category... (1 Reply)
Discussion started by: kalbsghir
1 Replies

2. Shell Programming and Scripting

Show the string in date format

Hello guys. how can print the: 20140206 like Fri, Feb 6, 2015 Thank you. (4 Replies)
Discussion started by: Ymir
4 Replies

3. Shell Programming and Scripting

Format DATA

Input File AU01NAS002,FCNVX133800117,AU01_Melbourne_Australia,ATT,Internal,NAS SILVER,12287.99,3293.98,6946.02 AU01NAS002,FCNVX133800117,AU01_Melbourne_Australia,ATT,Internal,NAS ARCHIVE,12287.99,3327.12,6912.87... (6 Replies)
Discussion started by: greycells
6 Replies

4. Shell Programming and Scripting

awk to calculate date and show data

data: hostcomment { host_name=myhost01 entry_type=1 comment_id=1 source=0 persistent=1 entry_time=1415723753 expires=0 expire_time=0 author=hpsm comment_data=IM0837437472 } program { modified_host_attributes=1 modified_service_attributes=1 enable_notifications=1... (20 Replies)
Discussion started by: SkySmart
20 Replies

5. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

6. Shell Programming and Scripting

getting the data in some format

HI i am writing a shell script to generate some files having data in some format. for this i am using awk -F":" '{printf("%-20s:%-20s:%-20s:%-20s:%-15s:%-3s:%-19s:%-2s:%-20s:%-15s:%-2s\n", $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)}' $DIALPBIN/temp1.txt > ${DIALPBIN}/temp2.txt this helps in... (1 Reply)
Discussion started by: priyanka3006
1 Replies

7. Shell Programming and Scripting

Show file to new format

Hi all If my text file as follow: group size time file other 58585739 2008 test1.csv other 122 2008 testcsv.sh other 164 19:28 testexplain.sh other 29132428 2008 testq.csv other 104 21:02 testshell.sh other 792 21:39 xxx.txt I need to show file to new format as follow: group... (1 Reply)
Discussion started by: almanto
1 Replies

8. Shell Programming and Scripting

Show file to new format

Hi all If my text file as follow: group size time file other 58585739 2008 test1.csv other 122 2008 testcsv.sh other 164 19:28 testexplain.sh other 29132428 2008 testq.csv other 104 21:02 testshell.sh other 792 21:39 xxx.txt I need to show file to new format as follow: group ... (5 Replies)
Discussion started by: almanto
5 Replies

9. UNIX for Dummies Questions & Answers

converting a tabular format data to comma seperated data in KSH

Hi, Could anyone help me in changing a tabular format output to comma seperated file pls in K-sh. Its very urgent. E.g : username empid ------------------------ sri 123 to username,empid sri,123 Thanks, Hema:confused: (2 Replies)
Discussion started by: Hemamalini
2 Replies

10. UNIX for Advanced & Expert Users

backup data with tar and show them

Hey everyone, i just want to backup data with tar. I know it works with: tar cvf. To show which data i have saved i can use tar tvf. But how can i do it simoultanous, that unix not first has to save my data to disk and after that read the data again to show me the list of my saved data? Please... (2 Replies)
Discussion started by: grashuepfer
2 Replies
Login or Register to Ask a Question