Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Difference between xargs and exec Post 73998 by vibhor_agarwali on Tuesday 7th of June 2005 07:51:19 AM
Old 06-07-2005
Thanks,

Any idea about finding out whether my find in Gnu one or not.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

difference between source, exec and ./script

What is the difference between sourcing a script, running it or execing it? (1 Reply)
Discussion started by: 98_1LE
1 Replies

2. Shell Programming and Scripting

MV files with xargs or -exec

Hi I need to move multiple (say 10 files) from one location to another location. My selection would be like this... ls -ltr *.arc | head ---> Need to move top 10 files with single command without iterating in loop. I know we can move files like this with find command but not sure if I can... (4 Replies)
Discussion started by: malaymaru
4 Replies

3. Shell Programming and Scripting

String substitution on find results inside exec/xargs

What I'm trying to do is perform a copy, well a ditto actually, on the results of a find command, but some inline string substitution needs to happen. So if I run this code find ./ -name "*.tif" I get back these results. .//1234567.tif .//abcdefg.tif Now the action from exec or xargs I... (2 Replies)
Discussion started by: myndcraft
2 Replies

4. AIX

Difference in Using xargs

Hi , Can somebody explain what is the difference in the below commands.. when using Xargs its giving all the hidden files and is it something xargs will do recursive searching or parsing ? find . -type f -links 1 | xargs ls -li find . -type f -links 1 | ls -li (1 Reply)
Discussion started by: Karthikeyan K
1 Replies

5. Shell Programming and Scripting

Difference between using xargs and backticks

Hey all. Just a fast question, what is the technical difference between using back ticks and using xargs to perform a command? Here's an example Find /mydir -name *.conf |xargs rm Vs Rm 'find /mydir -name *.conf' Is there a performance hit? I know they do the same thing but which is... (1 Reply)
Discussion started by: msarro
1 Replies

6. Programming

difference bewteen pipe, xargs, and exec

I have read several docs on these on the web and looked at examples. I can't figure out the difference. In some cases you use one or the other or you combine them. can someone help me understand this? (1 Reply)
Discussion started by: guessingo
1 Replies

7. Shell Programming and Scripting

Script Variables Inquiry, Values Okay in Standalone Exec, No-Show in Cron Exec

I have the following bash script lines in a file named test.sh. #!/bin/bash # # Write Date to cron.log # echo "Begin SSI Load $(date +%d%b%y_%T)" # # Get the latest rates file for processing. # d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1) filename=$d export filename... (3 Replies)
Discussion started by: ginowms
3 Replies

8. Shell Programming and Scripting

xargs vs exec with find:

Hi All, i'm trying to create a tar of all the .txt files i find in my dir . I've used xargs to acheive this but i wanted to do this with exec and looks like it only archives the last file it finds . can some one advice what's wrong here : find . -type f -name "*.txt" -print0 | xargs -0... (9 Replies)
Discussion started by: Irishboy24
9 Replies

9. Shell Programming and Scripting

Difference b/w xargs and "-exec" in Find

Hi, What is the difference between the following commands find . -type f -exec grep 'abc' {} \; and find . -type f | xargs grep 'abc' Appreciate your help. (2 Replies)
Discussion started by: bobbygsk
2 Replies

10. Shell Programming and Scripting

Exec and xargs mvoe file to directory

Hello, I am trying to move all the file listed by below command to /tmp/testing directory find ./ -maxdepth 1 -type f -mtime +3 I tried using -exec and xargs - none of the combination is working? Please, help (3 Replies)
Discussion started by: saurabh84g
3 Replies
Email::Find(3pm)					User Contributed Perl Documentation					  Email::Find(3pm)

NAME
Email::Find - Find RFC 822 email addresses in plain text SYNOPSIS
use Email::Find; # new object oriented interface my $finder = Email::Find->new(&callback); my $num_found - $finder->find($text); # good old functional style $num_found = find_emails($text, &callback); DESCRIPTION
Email::Find is a module for finding a subset of RFC 822 email addresses in arbitrary text (see "CAVEATS"). The addresses it finds are not guaranteed to exist or even actually be email addresses at all (see "CAVEATS"), but they will be valid RFC 822 syntax. Email::Find will perform some heuristics to avoid some of the more obvious red herrings and false addresses, but there's only so much which can be done without a human. METHODS
new $finder = Email::Find->new(&callback); Constructs new Email::Find object. Specified callback will be called with each email as they're found. find $num_emails_found = $finder->find($text); Finds email addresses in the text and executes callback registered. The callback is given two arguments. The first is a Mail::Address object representing the address found. The second is the actual original email as found in the text. Whatever the callback returns will replace the original text. FUNCTIONS
For backward compatibility, Email::Find exports one function, find_emails(). It works very similar to URI::Find's find_uris(). EXAMPLES
use Email::Find; # Simply print out all the addresses found leaving the text undisturbed. my $finder = Email::Find->new(sub { my($email, $orig_email) = @_; print "Found ".$email->format." "; return $orig_email; }); $finder->find($text); # For each email found, ping its host to see if its alive. require Net::Ping; $ping = Net::Ping->new; my %Pinged = (); my $finder = Email::Find->new(sub { my($email, $orig_email) = @_; my $host = $email->host; next if exists $Pinged{$host}; $Pinged{$host} = $ping->ping($host); }); $finder->find($text); while( my($host, $up) = each %Pinged ) { print "$host is ". $up ? 'up' : 'down' ." "; } # Count how many addresses are found. my $finder = Email::Find->new(sub { $_[1] }); print "Found ", $finder->find($text), " addresses "; # Wrap each address in an HTML mailto link. my $finder = Email::Find->new( sub { my($email, $orig_email) = @_; my($address) = $email->format; return qq|<a href="mailto:$address">$orig_email</a>|; }, ); $finder->find($text); SUBCLASSING
If you want to change the way this module works in finding email address, you can do it by making your subclass of Email::Find, which over- rides "addr_regex" and "do_validate" method. For example, the following class can additionally find email addresses with dot before at mark. This is illegal in RFC822, see Email::Valid::Loose for details. package Email::Find::Loose; use base qw(Email::Find); use Email::Valid::Loose; # should return regex, which Email::Find will use in finding # strings which are "thought to be" email addresses sub addr_regex { return $Email::Valid::Loose::Addr_spec_re; } # should validate $addr is a valid email or not. # if so, return the address as a string. # else, return undef sub do_validate { my($self, $addr) = @_; return Email::Valid::Loose->address($addr); } Let's see another example, which validates if the address is an existent one or not, with Mail::CheckUser module. package Email::Find::Existent; use base qw(Email::Find); use Mail::CheckUser qw(check_email); sub do_validate { my($self, $addr) = @_; return check_email($addr) ? $addr : undef; } CAVEATS
Why a subset of RFC 822? I say that this module finds a subset of RFC 822 because if I attempted to look for all possible valid RFC 822 addresses I'd wind up practically matching the entire block of text! The complete specification is so wide open that its difficult to construct soemthing that's not an RFC 822 address. To keep myself sane, I look for the 'address spec' or 'global address' part of an RFC 822 address. This is the part which most people consider to be an email address (the 'foo@bar.com' part) and it is also the part which contains the information necessary for delivery. Why are some of the matches not email addresses? Alas, many things which aren't email addresses look like email addresses and parse just fine as them. The biggest headache is email and usenet and email message IDs. I do my best to avoid them, but there's only so much cleverness you can pack into one library. AUTHORS
Copyright 2000, 2001 Michael G Schwern <schwern@pobox.com>. All rights reserved. Current maintainer is Tatsuhiko Miyagawa <miyagawa@bulknews.net>. THANKS
Schwern thanks to Jeremy Howard for his patch to make it work under 5.005. LICENSE
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself. The author STRONGLY SUGGESTS that this module not be used for the purposes of sending unsolicited email (ie. spamming) in any way, shape or form or for the purposes of generating lists for commercial sale. If you use this module for spamming I reserve the right to make fun of you. SEE ALSO
Email::Valid, RFC 822, URI::Find, Apache::AntiSpam, Email::Valid::Loose perl v5.8.8 2006-03-18 Email::Find(3pm)
All times are GMT -4. The time now is 07:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy