Reputation: 1
I know this question appears rather frequently, but I cannot seem to find a solution on importing a .txt file line by line to another .txt with the While Read command:
line="input.txt"
while read -r line; do
printf '%s\n' "$line"
done < outputfile.txt
I tried different alternatives, tried them all as variables, using the variables with their directories, tried cat on the input file, use of echo and printf but to no avail. Thanks in advance for any and all advance!
Upvotes: 0
Views: 806
Reputation: 7337
I think you are just trying to combine files ?
cat input.txt >> outputfile.txt
Not suggesting this but as an FYI :
file="input.txt"
while IFS= read -r line ;do
echo "${line}" >> outputfile.txt
done < "${file}"
Upvotes: 2