[YLUG] Manipulation of text files... anyone with lots of experience?

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Mon Jul 28 21:37:37 BST 2008


On 28 Jul 2008, at 20:49, Dan Bishop wrote:

> Basically, I have
> read as much as I ever care to read about sed, awk and regular
> expressions and have hit the point where I don't care how it  
> happens, I
> just want it to happen.

Its potentially just about doable as a regular expression  
transformation, but frankly it would be a pretty impressive  
transformation.  In which case you could express it in sed, its  
definitely doable in awk, but my weapon of choice for this stuff is perl

[And I have this horrid suspicion that if you searched CPAN you might  
find a module that deals with this form of dictionary.]

I've attached a bit of perl that does what you want on the assumption  
that all the definitions are each on a single line (ie that the  
Abenteuerreise definition should have not been split across 2 lines).

If that assumption cannot be supported then you need to have some  
rules defining how lines can be split otherwise it gets really really  
messy.

	Nigel.
--
[ Nigel Metheringham             Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: langsplit.pl
Type: text/x-perl-script
Size: 1583 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/york/attachments/20080728/a2ef0ab5/langsplit-0001.bin


More information about the York mailing list