in reply to reading from file

There is not much to say about this.
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; while (<DATA>) { chomp; /^(.+) (<.+>) (\(.+\)) (.+) (.+)$/; print "$1 $3 $5\n"; } __DATA__ aanis <aanis@xyz.com> (Anis Ahmed A) accessed 2007/10/04 aaputin <aaputin@xyz.com> (Artem Aputin) accessed 2007/10/04 aazarov <alexey.azarov@tlmcom.ru> (Alexey Azarov) accessed 2007/10/04

And the output is-

aanis (Anis Ahmed A) 2007/10/04 aaputin (Artem Aputin) 2007/10/04 aazarov (Alexey Azarov) 2007/10/04

Replies are listed 'Best First'.
Re^2: reading from file
by johny (Novice) on Oct 10, 2007 at 07:51 UTC
    Hi Thanks a lot Bruceb3
    Can you explain the what this line exactly this does. /^(.+) (<.+>) (\(.+\)) (.+) (.+)$/;
    and i'dont want to include braces around the name(I want it to be (aanis Anis Ahmed A 2007/10/04)) and also it should take only if the first column is a word and exclude if it is an digit.
    These should be excluded. 000-01 <000-01@BONNIEB> (000-01) accessed 2007/08/21
    Thanks a lot once again. Regards Johny
      for unix shell:
      perl -lane 's/[)(]//g for @F; print"@F[0,2..$#F-2,$#F]" unless /^\d/' + input
      for win cmd shell:
      perl -lane "s/[)(]//g for @F; print qq{@F[0,2..$#F-2,$#F]} unless /^\ +d/" input
      Regards

      mwa

      When you must use this pattern:

      /^(\w+) <(.+)> (\(.+\)) (.+) (.+)$/;