How can I do with bash
echo "line1 from file2" >> echo "line1 from file1"
?
@matrix Not sure if I understand it correctly. You have one file with lines and one with filenames and you want to write line from first file with name from the second file?
@Mac_CZ Yes and do that for each line
@matrix seq `wc file1 | awk -c '{print $1}'` | parallel -- 'sed -n {}p file1 >> `sed -n {}p file2 | tr -d "\n"`'
@matrix But it needs same number of lines in both files.
@matrix how about:
i=1;<file1 while read l; do echo $l >> $(sed "${i}q;d" file2); i=$[i+1]; done
I got a better one:
for run in {1..x}; do sed -n "$run,${run}p" file1 >> `sed -n "$run,${run}p" file2`;done