I have two files, and want to merge data line by line. The input files are file.txt and file2.txt.
file1.txt
howareu
abc
zooo
file2.txt
123
@@
099
I want to merge the two file, such that output will be:
output.txt
howareu123
howareu@@
howareu0999
abc123
abc@@
abc0999
zooo123
zooo@@
zooo0999
Is there way to do that? Is there a way to use the sed
or paste
command to obtain the result?
There's usually some elegant way to do a task, but you may spend more time looking for it than just brute force. Not using sed or paste (just shell builtins):
So long as
file2.txt
is not too large, I'd suggest awk: