I have 4 files say:
cat test1
1
2
3
cat test2
4
5
6
cat test3
7
8
9
I need to display the content as below side by side:
1 4 7
2 5 8
3 5 9
I tried pr -m -t test1 test2 test3
, but if if any value is large, the output is getting trim, I need to display the content according to the length of the value and should display the content side by side(column wise)
The -m flag causes the pr command to merge the two files into two columns on a single page. Without the flag, pr will concatenate both files into two pages of output instead of displaying them in columns. Additionally, the flag -t removes the default header and newlines in the output.
log log files, you can view them both in one terminal by executing tail -f command . Save this answer. Usage: multitail <filename1> <filename2> . So the output will be part of file1 and part of file2 in the same terminal.
Paste command is one of the useful commands in Unix or Linux operating system. It is used to join files horizontally (parallel merging) by outputting lines consisting of lines from each file specified, separated by tab as delimiter, to the standard output.
Printing two columnsThe pr command can print text in multiple columns. For example, -2 prints in two columns and -3 will print in three columns.
You can simple do it like :
cat *.txt | paste -d " " - - - | sed 's/_//g'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With