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
# 8  
Old 05-05-2006
Thanks . it is working but i have one problem

sometimes $1 $2 doesnt match with $4 $5
i want to print those rows also in table format .

can i do that
it may happen some test cases doesnt run on that day
so i want to print blank on that

i am printing format like this
Vers Host Fails date Fails date2
10 Test1 30 24
10 Test2 34 67
11 Test1 65
11 Test2 65


Please help me
# 9  
Old 05-05-2006
Try this

Put this code in a shell script
For eg. test_script.sh

file1=$1
file2=$2

while read a b c
do
v1=$a$b
lp="$a $b $c"
while read x y z
do
v2=$x$y
if [ $v1 = $v2 ]
then
lp="$lp $z"

fi
done < $file2
echo $lp

done < $file1

Then run the shell script
For eg. test_script.sh yourfile1 yourfile2
# 10  
Old 05-05-2006
rajeeb_d,
you've missed the point:
Quote:
Originally Posted by getdpg
where $1,$2 of A file is same as $4 $5 of B file
Code:
FNR==NR { arr[$1 OFS $2]=$3; next }
{
   idx=$1 OFS $2
   printf("%s\n", (idx in arr) ? idx OFS arr[idx] OFS $3 : $0)
}

# 11  
Old 05-06-2006
how come we have such a similar problem ? Smilie
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