Reputation: 143
Problem:
Printing the first line of 4 text files side by side
Suppose File 1
namexyz
nameabcd
So on
File 2:
producturl1
producturl2
so on
Similarly i have 2 more files.
Expected Output (Trying to create a CSV):
namexyz,producturl1,file3data,file4data
nameabcd,producturl2,file3data,file4data
What i tried (a newbie in unix):
while ((num<COUNT)) && read -u3 name && read -u4 price && read -u5 imageurl && read -u6 purl && read -u7 gdesc
do
echo "Mobiles,$1,$name,$price,,$imageurl,Amazon,$purl,Description,$gdesc" >> trial.csv
((num++))
done 3< names 4<amazonprice 5<imageurls 6<amazonurl 7<description
names, amazonprice, imageurls, amazonurls, description all are the name of files.
Upvotes: 0
Views: 92
Reputation: 88581
With paste
from GNU Core Utilities:
paste -d, file1 file2 file3 file4
Upvotes: 3