Tille - I can see you, read those man pages!   Tille's Site

Exercise on awk


This is from the Linux Documentation Project, for which I write and help out from time to time. Binh Nguyen, author of the Linux dictionary, wanted a way to convert his text file, containing thousands of Linux-related words, together with their definitions, to DocBook XML.

The input file contains entries, separated by blank lines. The word and its definition are separated from eachother by tabs:

Word	definition in very long line

word	long line

otherword	more longline

testword	looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong line, but i mean really looooooooooooooooooooooooooooooooooooooooooooooooooong.

The output should look like this:

<entry>Word</entry><entry>definition in very long line</entry>

<entry>word</entry><entry>definition in very long line</entry>


Click here for a possible solution.

© 1995-2010 Machtelt Garrels - tille - Powered by vIm - Best viewed with your eyes - Validated by W3C - Last update 20100511