I have a text file that looks like
file1 value1
file1 value2
file2 value1
file2 value2
file2 value3
I want to split the text file in multiple files, with the filenames from column1 and column2 as content of the files, like
file1_new.txt
value1
value2
file2_new.txt
value1
value2
value3
I tried it with the following script, but that does not work. Can someone please help me with rewriting the script?
cat input.txt | while read file value; do
echo "$value" > "$file"_new.txt
done