I have the following script:
file="home/report.csv"
while IFS= read -r line
do
sed 's/\,/;/' > tmp.txt
done <"$file"
file2="home/tmp.txt"
while IFS= read -r line
do
awk -F. '{print $1";service" > "report_v2.csv"}' OFS=;
done <"$file2"
After the first "While", the file "tmp.txt" does not have the first line of "report.csv". Then, after the second "While", the file report_v2.csv does not have the first line of tmp.txt.
Hence, the last file has two lines less than the original one.
This is an example of my files:
report.csv
1,foo
2,pippo
3,pluto
4,davis
tmp.txt
2;pippo
3;pluto
4;davis
report_v2.csv
3;pluto;service
4;davis;service
I need to keep the first two lines of the original file also in the last file. How can I do?
Thanks
> tmp.txt
with>> tmp.txt
.