Sponsored Content
Top Forums Shell Programming and Scripting Extract e-mail addresses on a page Post 302776433 by phil_heath on Wednesday 6th of March 2013 10:20:11 AM
Old 03-06-2013
Quote:
Originally Posted by rdrtx1
try:
Code:
perl -e 'while(<>) {@words=split; foreach $w (@words) {print "$w\n" if $w=~/.[@]./}}' infile


Thank you! This works very well but I get a "." at the end of some e-mails. For instance if the email is bob@bob.com. then I get bob@bob.com. and not just bob@bob.com

Any solution around this would be fine. Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

unix-mail to external websites/addresses

Hi all, I would like to know if I can send unix mail to 'external email addresses'. My unix server is leo@ABCcompany.com. I am able to send emails to firstname.lastname@ABCcompany.com. But, we have some email addresses in our team on our parent company's server - ex:... (2 Replies)
Discussion started by: Joy_K
2 Replies

2. Shell Programming and Scripting

Extract IP addresses

The only way I could extract the user names and 'from' IP addresses is to use a few temp files. Split up by 'Failed keyboard-interactive' and 'Failed password'. Anyone have any idea to do this all in one go? aaa.bbb.ccc.ddd 2009-03-23 01:28:33 sshd: Failed keyboard-interactive/pam... (2 Replies)
Discussion started by: hazno
2 Replies

3. Shell Programming and Scripting

How can i send mail to multiple addresses in same domain in bash?

Suppose i have a txt file that is the list of the addresses,something like: lala0045 john james lala0234 george james and i want to send an email to lala0045@blabla.com and lala0234@blabla.com,the same domain...what is the exact syntax i should use in my script? there is a command... (10 Replies)
Discussion started by: bashuser2
10 Replies

4. Shell Programming and Scripting

Echo - Sending mail to multiple addresses

Hi, If I want my script to send a mail to multiple recipients I can do the following: if then echo $err_string1 | mailx -s "UAT CPU ALERT" 1@email.com echo $err_string1 | mailx -s "UAT CPU ALERT" 2@email.com fi Can this also be done something like: ... (1 Reply)
Discussion started by: runnerpaul
1 Replies

5. Shell Programming and Scripting

How to extract url from html page?

for example, I have an html file, contain <a href="http://awebsite" id="awebsite" class="first">website</a>and sometime a line contains more then one link, for example <a href="http://awebsite" id="awebsite" class="first">website</a><a href="http://bwebsite" id="bwebsite"... (36 Replies)
Discussion started by: 14th
36 Replies

6. Shell Programming and Scripting

Extract list of IP addresses from a text file.

I have an xml file with IP addresses all over the show. I want to print only the IP addresses and cut off any text before or after the IP address. Example: Note: The IP addresses (x.x.x.x) do not consistently appear in the xml file as per the pattern below. Sometimes there are text before... (8 Replies)
Discussion started by: lewk
8 Replies

7. Shell Programming and Scripting

Perl - match e-mail addresses in multiple files

Hi, I'm trying to write a script that will check multiple files in a directory (all the relevant filenames begin "TT04.NOTES") for e-mail addresses, and then print these addresses to screen with a count at the bottom. I'm a bit of a novice with Perl but thought it would be the best tool for the... (2 Replies)
Discussion started by: wf1974
2 Replies

8. Shell Programming and Scripting

Parse Page Source and Extract Links

Hi Friends, I have a bunch of URLs. Each URL will open up an abstract page. But, the source contains a link to the main PDF article. I am looking for a script to do the following task 1. Read input file with URLs. 2. Parse the source and grab all the lines that has the word 'PDF'.... (1 Reply)
Discussion started by: jacobs.smith
1 Replies

9. Shell Programming and Scripting

Getting web page content and deliver via mail

Guys could you please help. I want to have shell scripts that get the website html content and same time mail html page to DL. Can any1 help here? (2 Replies)
Discussion started by: AnkitC
2 Replies

10. UNIX for Beginners Questions & Answers

Sifting out mail addresses with grep and regex

Hi there from a newbie. So, I have this huuuge portion of mail addresses with names interlaced.. looks like: "name1" <mail1@domain1.com>, "name2" <mail2@domain2.com> ... Sometimes there are no names, just mailaddress. My thought was to use regex with grep. I saved the list in file ma and... (2 Replies)
Discussion started by: dr_xemacs
2 Replies
Email(3pm)						User Contributed Perl Documentation						Email(3pm)

NAME
Data::Validate::Email - common email validation methods SYNOPSIS
use Data::Validate::Email qw(is_email is_email_rfc822); if(is_email($suspect)){ print "Looks like an email address "; } elsif(is_email_rfc822($suspect)){ print "Doesn't much look like an email address, but passes rfc822 "; } else { print "Not an email address "; } # or as an object my $v = Data::Validate::Email->new(); die "not an email" unless ($v->is_email('foo')); DESCRIPTION
This module collects common email validation routines to make input validation, and untainting easier and more readable. All functions return an untainted value if the test passes, and undef if it fails. This means that you should always check for a defined status explicitly. Don't assume the return will be true. (e.g. is_username('0')) The value to test is always the first (and often only) argument. FUNCTIONS
new - constructor for OO usage new([\%opts]); Description Returns a Data::Validator::Email object. This lets you access all the validator function calls as methods without importing them into your namespace or using the clumsy Data::Validate::Email::function_name() format. Arguments An optional hash reference is retained and passed on to other function calls in the Data::Validate module series. This module does not utilize the extra data, but some child calls do. See Data::Validate::Domain for an example. Returns Returns a Data::Validate::Email object is_email - is the value a well-formed email address? is_email($value); Description Returns the untainted address if the test value appears to be a well-formed email address. This method tries to match real-world addresses, rather than trying to support everything that rfc822 allows. (see is_email_rfc822 if you want the more permissive behavior.) In short, it pretty much looks for something@something.tld. It does not understand real names ("bob smith" <bsmith@test.com>), or other comments. It will not accept partially-qualified addresses ('bob', or 'bob@machine') Arguments $value The potential address to test. Returns Returns the untainted address on success, undef on failure. Notes, Exceptions, & Bugs This function does not make any attempt to check whether an address is genuinely deliverable. It only looks to see that the format is email-like. The function accepts an optional hash reference as a second argument to change the validation behavior. It is passed on unchanged to Neil Neely's Data::Validate::Domain::is_domain() function. See that module's documentation for legal values. is_email_rfc822 - does the value look like an RFC 822 address? is_email_rfc822($value); Description Returns the untainted address if the test value appears to be a well-formed email address according to RFC822. Note that the standard allows for a wide variety of address formats, including ones with real names and comments. In most cases you probably want to use is_email() instead. This one will accept things that you probably aren't expecting ('foo@bar', for example.) Arguments $value The potential address to test. Returns Returns the untainted address on success, undef on failure. Notes, Exceptions, & Bugs This check uses Casey West's Email::Address module to do its validation. The function does not make any attempt to check whether an address is genuinely deliverable. It only looks to see that the format is email-like. is_domain - does the value look like a domain name? is_domain($value); Description Returns the untainted domain if the test value appears to be a well-formed domain name. This test uses the same logic as is_email(), rather than the somewhat more permissive pattern specified by RFC822. Arguments $value The potential domain to test. Returns Returns the untainted domain on success, undef on failure. Notes, Exceptions, & Bugs The function does not make any attempt to check whether a domain is actually exists. It only looks to see that the format is appropriate. As of version 0.03, this is a direct pass-through to Neil Neely's Data::Validate::Domain::is_domain() function. The function accepts an optional hash reference as a second argument to change the validation behavior. It is passed on unchanged to Neil Neely's Data::Validate::Domain::is_domain() function. See that module's documentation for legal values. is_username - does the value look like a username? is_username($value); Description Returns the untainted username if the test value appears to be a well-formed username. More specifically, it tests to see if the value is legal as the username component of an email address as defined by is_email(). Note that this definition is more restrictive than the one in RFC822. Arguments $value The potential username to test. Returns Returns the untainted username on success, undef on failure. Notes, Exceptions, & Bugs The function does not make any attempt to check whether a username actually exists on your system. It only looks to see that the format is appropriate. AUTHOR
Richard Sonnen <sonnen@richardsonnen.com>. COPYRIGHT
Copyright (c) 2004 Richard Sonnen. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2009-02-01 Email(3pm)
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy