I have a lot of numbered *.csv files with different numbers of lines and just as many *.txt files. I want to append on every line of file 1.csv the content of file 1.txt, on every line of file 2.csv the content of file 2.txt and so on. Each *.txt file contains only one line.
What I have tried:
for i in {1..2}; do for j in {1..2}; do perl -i -p -e "s/^(.+?)$/\1<content of $j.txt>/g" ./$i.csv; done; done
But obviously this doesn't work.
example (initial situation):
1.csv
line 1
line 2
line 3
2.csv
line 1
line 2
1.txt
yyy
2.txt
zzz
result (should be):
1.csv
line 1yyy
line 2yyy
line 3yyy
2.csv
line 1zzz
line 2zzz
1.txt
yyy
2.txt
zzz
Any help would be appreciated.