Reputation: 13
I've got 3 (or more) log files and I wish to create a combined log report when the output of each file is in a different column.
Example:
$ cat log1
test1
1
1
1
$ cat log2
test2
2
2
2
What I'm looking for is a way to create the below report into a new log file:
test1 test2
1 2
1 2
1 2
Upvotes: 1
Views: 247
Reputation: 26667
You can try paste
$ paste log1 log2
test1 test2
1 2
1 2
1 2
From man page
paste - merge lines of files
Write lines consisting of the sequentially corresponding lines from each FILE, separated by TABs, to standard output. With no FILE, or when
FILE is -, read standard input.
EDIT
When there are more lines in file2
$ cat log1
test1
1
1
1
$ cat log2
test2
2
2
2
2
2
2
$ paste log1 log2
test1 test2
1 2
1 2
1 2
2
2
2
Upvotes: 1