Sorry. Each result will give a header row with dates. Which will be quite redundant. But I reckon I'll be able to deal with that mess once all the data is aligned in columns.
I'm using this to access a website using cURL to download each company's turnover. After I sanitize the output from cURL i get a list like this. Comments are for illustration only here, not in actual output.
2010-12 # year 1
2009-12 # year 2
2008-12 # year 3
46.706 # turnover year 1
37.984 # turnover year 2
53.632 # turnover year 3
In my script I append the company name from the original input file as i don't want to get that from the web each time. Currently I add this to the top of each batch of 6 lines so the output looks like
Burgundy # Company name appended from input file
2010-12 # year 1
2009-12 # year 2
2008-12 # year 3
46.706 # turnover year 1
37.984 # turnover year 2
53.632 # turnover year 3
Now, I need to have all this in 4 columns like this
Thanks for your help! The problem was that the output had DOS newlines and I had to take care of the trailing and leading spaces. So the paste didn't work. Once converted it works like a charm. The full, ugly script now looks like
#!/bin/ksh
start="Y"
while read comp
do
read year1
read year2
read year3
if [ start = "Y" ]
then
echo Company $year1 $year2 $year3
start="N"
fi
read a b
read a1 b1
read a2 b2
echo $comp $a $b $a1 $b1 $a2 $b2
done
If the two -- characters between the sets are actually part of the data, either remove them first, or add another read statement before the done statement.
I didn't see all the solutions on page 2 until I finished my post. -