Hello,
I have been trying to create a script that will take a tab delimited file with fields that are sometimes null or blank and stack the column info into separate records with different x/y coordinate positions. The first record of text1 would have a slightly different y value than the following records of text2,text3,etc.
My data file looks like this:
The input format is tab delimited.
First record is a header description only, ignore it.
x y data data data data data id
0 0 text1 text2 text3 "9,999" "-14,000" 1
10 20 text1 text3 "9,999" "-14,000" 2
20 30 text1 text2 "9,999" "-14,000" 3
I would like it to look like this result:
The output is also tab delimited.
10 11 text1
10 9 text2
10 8 text3
10 7 "9,999"
10 6 "-14,000"
10 5 1
20 31 text1
20 29 text3
20 28 "9,999"
20 27 "-14,000"
20 26 2
30 41 text1
30 39 text2
30 38 "9,999"
30 37 "-14,000"
30 36 3
I have had some luck in reformating the data from record input into a stacked format using
for (i=3;i<=NF;i++) print x+10;y+20,$i;
except here's the problem:
I need to always add a constant of 10 to the x, and slightly offset the y coordinate of the text1 record with a different y increment than the following text items for that group.
If the group of text items is minus or blank the script would continue with the next item in a neat stack of text info with no blank lines.
Thanks for any ideas.
I have been trying to create a script that will take a tab delimited file with fields that are sometimes null or blank and stack the column info into separate records with different x/y coordinate positions. The first record of text1 would have a slightly different y value than the following records of text2,text3,etc.
My data file looks like this:
The input format is tab delimited.
First record is a header description only, ignore it.
x y data data data data data id
0 0 text1 text2 text3 "9,999" "-14,000" 1
10 20 text1 text3 "9,999" "-14,000" 2
20 30 text1 text2 "9,999" "-14,000" 3
I would like it to look like this result:
The output is also tab delimited.
10 11 text1
10 9 text2
10 8 text3
10 7 "9,999"
10 6 "-14,000"
10 5 1
20 31 text1
20 29 text3
20 28 "9,999"
20 27 "-14,000"
20 26 2
30 41 text1
30 39 text2
30 38 "9,999"
30 37 "-14,000"
30 36 3
I have had some luck in reformating the data from record input into a stacked format using
for (i=3;i<=NF;i++) print x+10;y+20,$i;
except here's the problem:
I need to always add a constant of 10 to the x, and slightly offset the y coordinate of the text1 record with a different y increment than the following text items for that group.
If the group of text items is minus or blank the script would continue with the next item in a neat stack of text info with no blank lines.
Thanks for any ideas.