Dear catkin, firstfire and grail,
first I'd like to apologize for replying after so many days. Second I'd like to thank you all three for helping me. Here're my comments.
Quote:
Originally Posted by catkin
You need a getline after print "@type xy" and before print $1,$(i+2) to read a line and thus assign values to $1 and $2.
|
This doesn't work. I get an awk syntax error:
awk: cmd. line:4: getline print $1,$(i+2)}
awk: cmd. line:4: ^ syntax error
Since I'm a novice in awk scripting, I suppose that something else also needs to be inputed in the script in order for it to work this way. I read the meaning of the getline command, but it's still beyond my current knowledge.
Quote:
Originally Posted by firstfire
Hi.
How about...
|
This one works perfectly. I still have to spend some time to figure how it actually works.
Quote:
Originally Posted by grail
And another:
Code:
awk '{for(i=2;i<=NF;i++)nums[i-1]=nums[i-1]((nums[i-1])?"\n":"")$1" "$i}END{for(x in nums)print "@target G0.S"x-1"\n@type xy\n"nums[x]}' bands.dat
|
This one works, but the 1st set starts with @target G0.S9 and not @target G0.S0, as I'd like it to. I have to spend some time here, also, in order to figure out what went amiss.
All in all, you have been very helpful; I'll mark this subject as solved, although I still do not understand why my initial script doesn't work, i.e. why doesn't it print the columns.
Yours,
Igor L.