I'm writing a script and here's how i'm inputting into the CurrentOutput.csv
file.
echo "$col1,$col2" >> CurrentOutput.csv
Input.txt
1.2.3.4
2.3.4.5
3.4.5.6
CurrentOutput.csv
1.2.3.4
,DNS1
2.3.4.5
,DNS2
3.4.5.6
,DNS3
DesiredOutput.csv
1.2.3.4,DNS1
2.3.4.5,DNS2
3.4.5.6,DNS3
I've tried echo -e "$col1,$col2\c"
and echo -n "$col1,$col2"
. Is it because I'm writing from a .txt
file to a .csv
file? What am I missing here?
Never mind I found out the answer, there was carriage returns and an
^M
char which I had never seen. This question can be deleted.