Here's your sample data in a code block to remove ambiguity about spacing after fishing around in "view page source" in my browser. I also realigned it to what I guess your data really looks like. The fact of spacing matters more to awk than the amount of spacing anyhow, but everyone who posts here should be aware that alignment gets ruined by the VBcode->HTML conversion unless it's in a code block.
hey, you are right about the spacing and the forum. i think this topic should be moved with the shell scripting forum. will the moderators do this for me
Nope. Your confusion may come from a mistaken notion that the pattern/action pairs look like exclusive cases, but you should look at them like a C switch statement: You fall through to the next "case" (awk "pattern") unless you encounter a "break" (awk "next"). So NF == 0 { next } skips empty lines. Then NF == 4 { tag = $1 } picks up the first field and goes to the next pattern when there are four fields. The next pattern is empty, so it matches every line that wasn't "next"-ed so far, and its action is to print the saved tag and the last two fields from the current input line. If there is exactly one field on a line, awk will break in this last case, but that wasn't part of the OP's stated problem.
When you're making a post to the forums, you should see some buttons above the textbox you type your message in. Look for a button with the # symbol on it to insert code. Read the help page for more on VB Code.
:p
#!/usr/bin/awk
NF == 0 { next } # Skip empty lines
NF == 1 { tag = $1; next } # Pick up the tag
NF == 3 { print tag, $(NF-1), $NF } # Print lines with data
Then you have to find some other way to characterize your data. F'rinstance, your "tag" lines always seem to start at the beginning of a line while the "appended" lines do not, so replace "NF==1" with "/[1]/", i.e., the line begins with a non-blank character.
In ssow's version, you can delete the "NF==0 { next}" line, because you're only printing on lines with 2 fields (per your change).