1

I asked a question on GPROF Automating the profling of C program using GPROF

It seems I have figure out half of the solution (I now know how to automate gporf using bash script). The other half is that if I have lets say 50 profiling results stored in analysis[i].text (with 1=1 to 50), how do I combine all those results in a single file so that I can compare all the results easily and may be easily copy the timings and plot a graph in excelsheet.

Final combined profiling result file may look like this;

run#    profiling result (as usual we get from gprof)               

1             matUnopt  time .....
              matOpt    time .....  

2             matUnopt  time .....
              matOpt    time .....  

3             matUnopt  time .....
              matOpt    time .....  

4             matUnopt  time .....
              matOpt    time .....  


and so on.

where each entry is taken from different file and combined like this. Now I can see all the results from different run or file in one table.

How do I do this?

Update To elaborate suppose I have two files: file1 and file2

file1

field 1
A
B


field 2
c
D


field 3
E
F

file2

field 1
G
H


field 2
I
J


field 3
K
L

Now what I want is a way to get:

file3

field 1
A
B
G
H

field 2
C
D
I
J


field 3
E
F
K
L
Community
  • 1
  • 1
user2799508
  • 844
  • 1
  • 15
  • 41
  • Is this already what you need? http://pubs.opengroup.org/onlinepubs/009695399/utilities/cat.html . You tagged your question "C" but I think, you want a shell solution (and you are on a POSIX system)? – mafso Jan 06 '14 at 10:42
  • I guess cat command would simply concatenate two files (ie, append at then end of the file), but I need field wise concatenation. so field 1 of file 1 and file 2 are concatenated, then field 2 of both these files are concatenated and so on. – user2799508 Jan 06 '14 at 12:12
  • I have updated my question to explain further what I am looking for. – user2799508 Jan 06 '14 at 12:19

1 Answers1

1

Use "gprof -s" to combine output files https://sourceware.org/binutils/docs/gprof/Sampling-Error.html

armb
  • 278
  • 2
  • 13