I have two text files that I want to combine in bash so that each line from one file is merged with each file in another file.
file1.txt
abc123
def346
ghj098
file2.txt
PSYC1001
PSYC1002
PSYC1003
I want to combine them so that line 1 of is file1
added to each line file2
with a channel delimiter |
between them.
eg.
PSYC1001|abc123
PSYC1002|abc123
PSYC1003|abc123
Then the same goes for the other lines in file1, so I get
PSYC1001|abc123
PSYC1002|abc123
PSYC1003|abc123
PSYC1001|def346
PSYC1002|def346
PSYC1003|def346
PSYC1001|ghj098
PSYC1002|ghj098
PSYC1003|ghj098<
I did similar simple text things in bash
, copying examples from this site, but I did not find an example that can do this. I would like to hear your suggestion. I know this should be easy, but I haven't developed it yet.
A1277 source
share