Hi,
Thank you for your question. AWK is pretty nifty for doing stuff like
that very quickly and easily.
Here is an example of the command you'll want to use, looking at your
example:
awk '{print "<title>",$1,"</title>","\n","<a href=\""$2"\">"$5"</a>" >
$3}' inputfile.txt
Let me try and explain what is going on.
The 'print' command is what you're using to generate the output, it is
contained between the curly brackets. Something between double quotes
is printed as is, e.g. "<title>" will output <title>. Anything not
between double quotes will be treated as an expression.
"\n" creates a newline in your file.
When there's a backslash before a double quote, that means 'ignore the
normal function of this double quote and output it instead'. That's
why you see \"", because you actually want a double quote on the
output, before closing the string of text.
The last bit '> $3', tells the print command to redirect its output to
a file with the filename the actual value of $3.
It's then just a matter of supplying the input file and you're done.
I have tested it and I believe this does what you want, I hope this
solves your problem. If you have any more questions, please do not
hesitate to ask.
Thanks
endo
Search strategy:
awk field output filename
://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=awk+field+output+filename
The AWK manual Redirecting Output to Files and Pipes
http://www.cs.uu.nl/docs/vakken/st/nawk/nawk_38.html#SEC41
Item Level Databases: database-specific processing of output
http://www.dur.ac.uk/a.j.gray/2hht5.htm |