I works on project in bash and i uses in some XML files to get my data.
I takes some tags from the XML file and i order them at one line-
For Example:
I have the tags
ItemName, ItemCode,ItemPrice for every item, e.g Coca-Cola item -
<ItemCode>7290011018931</ItemCode>
<ItemType>1</ItemType>
<ItemName>Coca Cole</ItemName>
<ManufacturerName>some-company.. </ManufacturerName>
<ManufactureCountry>DE</ManufactureCountry>
<bIsWeighted>0</bIsWeighted>
<UnitOfMeasure>100 ml</UnitOfMeasure>
<QtyInPackage>0</QtyInPackage>
<ItemPrice>4.80</ItemPrice>
<UnitOfMeasurePrice>1.92</UnitOfMeasurePrice>
<AllowDiscount>1</AllowDiscount>
<ItemStatus>0</ItemStatus>`
The program is work but very slowly (it taks for 5000 lines file at least 1.5 minutes to manufacture the new file)-
Most of the operstion are cut and order the file by :
cat ${xmlFile} | grep "ItemCode" | cut -d">" -f2 | cut -d"<" -f1 >Code1.txt
My question is if there is another way to improve that performance and if there is a command at bash that i need to use cerfully when i look for faster solution
Edit
code1.txt is list of Barcodes, i have 2 more files name1.txt and price1.txt and i comained them to one file by that code:
i=0
while (( i < numOfIterates )); do
let i++;
a=`head -n+${i} Name1.txt | tail -n+${i}`;
b=`head -n+${i} price1.txt| tail -n+${i}`;
c=`head -n+${i} code1.txt| tail -n+${i}`;
echo "$a" "$b" "$c";
done > Total-${FileName}.txt
When Total-${FileName}.txt
is the file in the format:
Name Price Barcode