While I was playing with awk
's multi file processing construct
awk 'NR == FNR { # some actions; next} # other condition {# other actions}' file*.txt
I asked myself, if it's possible to convert text files with different sizes for printing with awk
like with
pr -mt file*
Assuming:
file1.txt
arbitrary text of the first file,
which is not so long.
More arbitrary text of the first file.
file2.txt:
Arbitrary text of the second file.
More arbitrary text of the second file.
More and More arbitrary text of the second file.
It's going on.
But finally every text will end.
The output sould be like this:
$ pr -w150 -mt file*
arbitrary text of the first file, Arbitrary text of the second file.
which is not so long. More arbitrary text of the second file.
More and More arbitrary text of the second file.
More arbitrary text of the first file. It's going on.
But finally every text will end.
How to achieve this with awk
command only with having on file*.txt
?
awk
though? There are far better tools likepaste
orpv
which you mentioned. You would have to write a dedicated awk script for this, and that's kinda too broad a question. If you really want to do this, start writing it and ask if you get stuck.vim
. But while I was playing withawk
's multi file processing construct, I want to achieve this task withawk
. If this would be impossible, I would accept the answer.