Sponsored Content
Top Forums Shell Programming and Scripting SED With Regex to extract Email Address Post 302618943 by gary_w on Wednesday 4th of April 2012 03:33:37 PM
Old 04-04-2012
For the sake of another way to do it, I was interested in this question and did as little searching. I found a perl script at this site: Extract email addresses from big file. - Unix / Linux / BSD

Now I do not know perl but it seems to work.
Code:
$ cat x
#!/bin/ksh
echo "Email address is ab-c.x-yz@comp.com" |perl -wne'while(/[\w\.\-]+@[\w\.\-]+\w+/g){print "$&\n"}'

$ ./x
ab-c.x-yz@comp.com
$

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

2. UNIX for Advanced & Expert Users

Regex to match IP address

What do you think of this regex to match IP address? I have been reading up on regex and have seen some really long ones for IP. Would this fail in any scenarios? (+\.){3}* (5 Replies)
Discussion started by: glev2005
5 Replies

3. Shell Programming and Scripting

Using SED command in a shell script: Unterminated address regex

Hi All, I am trying to use a sed command in a shell script in order to delete some lines in a file and I got the following error message. I don't understand why it is not working 'cause I have tried with simple quotes, then with double-quotes, and it is not working. sed: -e expression #1,... (7 Replies)
Discussion started by: Alpha3363
7 Replies

4. Shell Programming and Scripting

Converting perl regex to sed regex

I am having trouble parsing rpm filenames in a shell script.. I found a snippet of perl code that will perform the task but I really don't have time to rewrite the entire script in perl. I cannot for the life of me convert this code into something sed-friendly: if ($rpm =~ /(*)-(*)-(*)\.(.*)/)... (1 Reply)
Discussion started by: suntzu
1 Replies

5. Shell Programming and Scripting

Regex: Extract substring between 2 separator

Hi Input: aa-bb-cc-dd.ee.ff.gg Output: dd I want to get the word after the last '-' until the first dot I have tried with regex lookbehind and lookahead like this: (?<=-).*(?=\.) but his returns too much bb-cc-dd.ee.ff (7 Replies)
Discussion started by: chitech
7 Replies

6. Solaris

Find and sed for an email address in Solaris 10

in Solaris 10 I am able to run: find . -type f -name "copy*" exec grep example.com {} \; and I get results. but when I try to find and sed: find . -type f -name "copy*" exec sed -e 's/user@example\.com/user2@example\.com' {} \; the command executes correctly but doesn't change... (6 Replies)
Discussion started by: os2mac
6 Replies

7. Forum Support Area for Unregistered Users & Account Problems

Cant use certain email address

I tried to re-register using my new email address which is <firstname>@<surname>.me But it never sent out the email confirmation. I had to hit the back button and use my gmail address instead and it came through instantly. Is there a problem with using .me addresses? (1 Reply)
Discussion started by: frustin
1 Replies

8. Shell Programming and Scripting

Sed: -e expression #1, char 16: unterminated address regex

I am trying to grep for a particular text (Do action on cell BL330) in a text file(sample.gz) which is searched in the content filtered by date+timestamp (2016-09-14 01:09:56,796 to 2016-09-15 04:10:29,719) on a remote machine and finally write the output into a output file on a local machine. ... (23 Replies)
Discussion started by: rbadveti
23 Replies

9. UNIX for Beginners Questions & Answers

Sed: -e expression #1, char 20: unterminated address regex

I am trying to add word in last of particular line. the same command syntex is running on prompt. but in bash script give error."sed: -e expression #1, char 20: unterminated address regex" Please help. for i in `cat servername`; do ssh -q -t root@$i sed -i '/simple_allow_groups =/s/$/,... (4 Replies)
Discussion started by: yash_message
4 Replies
SVNNOTIFY(1p)						User Contributed Perl Documentation					     SVNNOTIFY(1p)

Name
       svnnotify - Subversion activity notification

Usage
	 svnnotify --repos-path "$1" --revision "$2" [options]

Options
	 -p --repos-path PATH	      Path to the Subversion repository. Required.
	 -r --revision REVISION       Commit revision number. Required.
	 -t --to ADDRESS	      The notification destination email address.
				      Required unless --to-regex-map.
	 -x --to-regex-map TO=REGEX   A mapping between a destination email address
				      and a regular expression to match against the
				      directories affected by the commit. Required
				      unless --to or --to-email-map.
	    --to-email-map REGEX=TO   The inverse of --to-regex-map: Map a regular
				      expresion to an email address. Required unless
				      --to or --to-regex-map.
	 -f --from ADDRESS	      Email address to use in the From header.
	 -D --user-domain DOMAIN      Domain name to append to the username to
				      complete the email address in the From header.
	 -l --svnlook SVNLOOK	      Location of the svnlook executable.
	 -s --sendmail SENDMAIL       Location of the sendmail executable.
	 -E --set-sender	      Set the envelope sender to the from address.
	    --smtp ADDRESS	      Address for an SMTP server.
	    --smtp-user USERNAME      Username for authenticating to a SMTP server.
	    --smtp-pass PASSWORD      Password for authenticating to a SMTP server.
	    --smtp-authtype AUTHTYPE  Type of SMTP authentication.
	 -c --encoding ENCODING       The character encoding for reading and writing
				      data.
	    --svn-encoding ENCODING   The character encoding of the log message and
				      the repository files.
	    --diff-encoding ENCODING  The character encoding of the repository files.
	 -g --language LANGUAGE       Value for the Content-Language header and $LANG
				      environment variable.
	 -d --with-diff 	      Include the diff in the message.
	 -a --attach-diff	      Attach the diff to the message.
	 -w --diff-switches SWITCHES  Switches to pass to C<svnlook diff>.
	 -R --reply-to ADDRESS	      Address for use in the Reply-To header.
	    --add-header NAME=VALUE   Add an extra header to the email.
	 -P --subject-prefix PREFIX   String to prepend to the subject.
	 -C --subject-cx	      Include the context of the commit in the
				      subject.
	 -X --strip-cx-regex	      Regex to remove part of the CX file name from
				      the subject.
	 -O --no-first-line	      Do not include the first line of the log
				      message in the subject.
	 -i --max-sub-length LENGTH   Maximum size of the subject line.
	 -e --max-diff-length LENGTH  Maximum size of the diff output.
	 -H --handler HANDLER	      The notification handler, such as "HTML".
	 -F --filter FILTER	      An output filter, such as "Markdown".
	 -A --author-url URL	      Include link to specified author URL.
	 -U --revision-url URL	      Include links to specified Revision URL.
	 -T --rt-url URL	      Include links to specified Request Tracker URL.
	 -B --bugzilla-url URL	      Include links to specified Bugzilla URL.
	 -J --jira-url URL	      Include links to specified JIRA URL.
	 -G --gnats-url URL	      Include links to specified Gnats URL.
	    --ticket-map REGEX=URL    Regex and URL for custom ticket identifiers.
	    --header HEADER	      Text header to display before body.
	    --footer FOOTER	      Text footer to display at end of body.
	 -V --verbose		      Incremental verbose mode.
	 -h --help		      Print this usage statement and exit.
	 -m --man		      Print the complete documentation and exit.
	 -v --version		      Print the version number and exit.

       More options may be supported by the subclass of SVN::Notify specified by the "--handler" option or by filters specified by the "--filter"
       option. Consult the documentation of the relevant modules for details.

See Also
       See SVN::Notify for the complete documentation. If you're having issues with character encodings, see especially the Character Encoding
       Support section.

Author
       David E. Wheeler <david@kineticode.com>

Copyright and License
       Copyright (c) 2004-2009 Kineticode, Inc. Some Rights Reserved.

       This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

perl v5.10.1							    2011-03-15							     SVNNOTIFY(1p)
All times are GMT -4. The time now is 11:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy