Try this one: perl -e 'foreach (<>) { chomp; s/(.* )- .*/\1/; print;}' filename HTH, Eric On Sunday 20 June 2004 14:03, Rikard Johnels wrote:
Hello all! CAn anyone help me with a PERL (or other scripting language) oneliner?
Problem; I have a file with the layout; Item1 - description 1 Item2 - Description 2 Item3 - Description 3 ....
All lines are the same layout, but the Item differs in lenght. Item(n) is always one word (different lenghts The delimiter is allways " - " (<space>-<dash><space>) The Description is one or more sentences (all on one line)
I want the file to be converted to; "Item1 Item2 Item3...."
How do i do that? I tries fiddling with cut and grep but to no avail...
--
/Rikard
--------------------------------------------------------------------------- --------- Rikard Johnels email : rikjoh@norweb.se Web : http://www.rikjoh.com Mob : +46 (0)735 05 51 01
------------------------ Public PGP fingerprint ---------------------------- < 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78 46 1C EE 56 >