#!/usr/bin/awk -f
BEGIN {
FS="><";
print "XML Tags";
}
{
for(x=1; x<=NF; x++) {
if (x==1) {
f=$x">";
} else {
f="<"$x">";
}
if (f!="\n") {
printf f"\n";
}
}
}
END {
print "End of tags";
} $1;
Hi all,
I have an XML file that is all on one line. I am using the above AWK script to break it into lines. The script produces each field on a separate line, and then it prints the whole line again.
As this is a learning exercise for me would somebody be able to point out where I have gone wrong?
When I add a pattern as the condition in front of the default action I still get the same output, which is as explained above. The pattern I added was /SIZE/, which is a word in the only line in the file.
The output I am seeing is the same on my Gentoo box and my AIX box. So it must be my code.
It is driving me nuts ...