roothausen

  • Impressum
  • Administration
  • Kontaktformular
  • Jabber
  • Tagcloud
  • Twitter
  • Soup
  • Github

Entries tagged as perl

Entries tagged as perl

Related tags

linux&unix bad world blogging changes cheatsheet comic computer encryption feedreader fun hardware howto lighttpd media misc newsbeuter opensource privacy programming psi regular expression rss security server shortys software stuff tail -f /var/log/life tool web webwide zeitgeist android blog code codec contentmanagement im jabber java life linux markup networking presentation ruby s9y screenshot subnetting unix video vp8 webdesign xml xslt browser datamining documentation eigenfaces google gui http javascript realtime rest scala sdk websockets windows captcha firefox html mobile spam test truecrypt wordpress

Email Adreesen extrahieren

14:42

Friday, May 2. 2008

Gestern hatte ein Bekannter von mir Probleme aus einer Textdatei oder Shell-Pipeline Email-Adressen zu extrahieren. Ich habe darauf hin ein kleines Perlscript dafuer angefertigt. Falls jemand so etwas brauchen kann, darf er es weiter verwenden.

#!/usr/bin/perl -w
use strict;
use IO::Handle;
my @linearr;
if ($ARGV[0]) {
   my $infile = $ARGV[0];
   open FILEIN, "< ", $infile or die $!;
   @linearr = <FILEIN>;
   close FILEIN;
} else {
   @linearr = <STDIN>;
}
foreach my $line (@linearr) {
   if ( $line =~ m/(\w[-.\w]+\@[-.\w]+\.\w{2,3})\W/) {
      print("$1\n");
   }
}

Man kann Script auf zwei Arten verwenden: Entweder man uebergibt eine Datei als Parameter "./emailscript.pl /pfad/zur/datei" oder man "piped" die Daten in das Script "cat /pfad/zur/datei | ./emailscript.pl".

Ich wuensche euch viel Spass damit

Posted by admin in computer | Comments (2) | Trackbacks (0)
Defined tags for this entry: linux&unix, opensource, perl, programming, regular expression, software
Related entries by tags:
  • The VP8 Video Codec
  • My Bachelor Thesis: Scale the realtime web
  • Distributed contact management using HTTP
  • Gesichtserkennung/Eigenfaces
  • Scala - A Scalable Language
(Page 1 of 1, totaling 1 entries)

JavaScript String .fromCharCode

Calendar

« February '12 »
Mo Tu We Th Fr Sa Su
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29        

Quicksearch

Kategorien

  • XML computer
  • XML misc
  • XML web
  • XML zeitgeist


All categories

Archiv

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • Recent...
  • Older...

Feeds

  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 Comments

Links

Retinacast
Shackspace
Yaxim
Radio Tux
Kais Blog
Blumen Pfleiderer
Alk
paxos
filzo
Marc Seeger
polzifer
Moritz Haarmann

Tags

android bad world blog blogging browser changes code comic computer contentmanagement encryption feedreader firefox free fun google gui hardware howto html im jabber java life lighttpd linux linux&unix markup media misc mobile murphy networking newsbeuter opensource picture politics presentation privacy programming regular expression rss ruby s9y scala screenshot sdk security server shortys software stuff tail -f /var/log/life test tool tv unix video web webdesign webwide windows xml zeitgeist

Lizenz

Creative Commons License - Some Rights Reserved