Sponsored Content
Top Forums Shell Programming and Scripting Xargs: multiple commands to each argument Post 302936890 by urello on Sunday 1st of March 2015 01:03:30 PM
Old 03-01-2015
Xargs: multiple commands to each argument

Hello. There is my one-liner to get subjects of potential spam mails
Code:
sudo exiqgrep -bf "spamer@example.com" |cut -d' ' -f1 |xargs -I ~ sudo /usr/sbin/exim -Mvh ~ |grep 'Subject: '

I want to insert blank line after each iteration to make output more readable. I tried
Code:
sudo exiqgrep -bf "spamer@example.com" |cut -d' ' -f1 |xargs -I ~ sudo /usr/sbin/exim -Mvh ~ |grep 'Subject: ' && echo ""
sudo exiqgrep -bf "spamer@example.com" |cut -d' ' -f1 |xargs -I ~ echo "" && sudo /usr/sbin/exim -Mvh ~ |grep 'Subject: '
sudo exiqgrep -bf "spamer@example.com" |cut -d' ' -f1 |xargs -I ~ sh -c "echo \"\"; sudo /usr/sbin/exim -Mvh ~ |grep 'Subject: '"

Please advice.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Executing commands with xargs

I have a SQL script that requires values from the environment in order to execute. I found a way to get the desired results but my process is a little choppy. Any suggestions on how to clean this up would be greatly appreciated. SQL Script ------------- select a, b, c from d where a =... (1 Reply)
Discussion started by: bmopal
1 Replies

2. UNIX for Dummies Questions & Answers

1 alias 2 commands 1 argument

Hi, i want make 1 alias with two commands include to do two things at the same time like this: ex: do finger and last at the same time with only one word finla or something. Thanks.- /home/seba > finger dustin Login name: dustin In real life: Dustin Feldman Directory:... (3 Replies)
Discussion started by: seba
3 Replies

3. Shell Programming and Scripting

Can Xargs execute multiple commands of evry input file

Hello , I am trying to print the footer of evry file in the given directory with xargs command like follows ls -1 | xargs -I {} gzcat {} | tail -1 now problem with this is only last file foooter is getting printed as " | tail -1 " is getting executed for the last file. I know this can... (4 Replies)
Discussion started by: nilesrex
4 Replies

4. Shell Programming and Scripting

Using xargs for multiple functions

Hi Experts, I am trying to parse some syslog outputs into a separate file per node using the below syntax but am having issues when it comes to my Xargs statements. The command which I was intending on using was: cat syslogs | nawk '/From/ { print $3 }' | uniq | xargs -I {} grep {}... (5 Replies)
Discussion started by: krypton
5 Replies

5. UNIX for Dummies Questions & Answers

grep -v with multiple argument

Hi, I want to grep ORA-XXX errors in a file but not ORA-16055: FAL request rejected ORA-16401: archivelog rejected by RFS ORA-16040: ORA-12154 Then I thought of grep -v ORA-16055 ORA-16401 ORA-16040 ORA-12154 myfile that does not work. Any solution ? (other than : grep -v... (1 Reply)
Discussion started by: big123456
1 Replies

6. Shell Programming and Scripting

perform 3 awk commands to multiple files in multiple directories

Hi, I have a directory /home/datasets/ which contains a bunch (720) of subdirectories called hour_1/ hour_2/ etc..etc.. in each of these there is a single text file called (hour_1.txt in hour_1/ , hour_2.txt for hour_2/ etc..etc..) and i would like to do some text processing in them. Each of... (20 Replies)
Discussion started by: amarn
20 Replies

7. Shell Programming and Scripting

Xargs error: insufficient space for argument

I'm trying to crudely hack my way through some data processing. I have file.txt with around 17,000 lines like this: ACYPI002690-PA.aa.afa.afa.trim_phyml_tree_fullnames_fullhomolog.txt 3 72 71 ACYPI002690-PA.aa.afa.afa.trim_phyml_tree_fullnames_fullhomolog.txt 97 111 71... (1 Reply)
Discussion started by: pathunkathunk
1 Replies

8. UNIX for Advanced & Expert Users

Pass Multiple Commands and Open Multiple Xterms via PSS

Hello, I'm attempting to open multiple xterms and run a command as an SAP user via sudo using PSSH. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in to the servers in the file list, and SUDO to the SAP(ADM) user, but it won't do anything else... (11 Replies)
Discussion started by: icemanj
11 Replies

9. UNIX for Beginners Questions & Answers

Piping commands using xargs

Need help in piping commands using xargs I have several .tar.gz files that I need to list the folder content in a subdirectory. For example, a.tar.gz b.tar.gz c.tar.gz The following command works great for each .tar.gz file but it's a pain to run the tar command for each file. tar -tf... (11 Replies)
Discussion started by: april
11 Replies

10. Shell Programming and Scripting

Xargs to call python executable to process multiple bam files

I am running the below loop that to process the 3 bam files (which isn't always the case). A .py executable is then called using | xargs sh to further process. If I just run it with echo the output is fine and expected, however when | xargs sh is added I get the error. I tried adding | xargs... (4 Replies)
Discussion started by: cmccabe
4 Replies
Mail::SpamAssassin::PerMsgStatus(3)			User Contributed Perl Documentation		       Mail::SpamAssassin::PerMsgStatus(3)

NAME
Mail::SpamAssassin::PerMsgStatus - per-message status (spam or not-spam) SYNOPSIS
my $spamtest = new Mail::SpamAssassin ({ 'rules_filename' => '/etc/spamassassin.rules', 'userprefs_filename' => $ENV{HOME}.'/.spamassassin.cf' }); my $mail = Mail::SpamAssassin::NoMailAudit->new(); my $status = $spamtest->check ($mail); if ($status->is_spam()) { $status->rewrite_mail (); $mail->accept("caught_spam"); } ... DESCRIPTION
The Mail::SpamAssassin "check()" method returns an object of this class. This object encapsulates all the per-message state. METHODS
$isspam = $status->is_spam () After a mail message has been checked, this method can be called. It will return 1 for mail determined likely to be spam, 0 if it does not seem spam-like. $list = $status->get_names_of_tests_hit () After a mail message has been checked, this method can be called. It will return a comma-separated string, listing all the symbolic test names of the tests which were trigged by the mail. $num = $status->get_hits () After a mail message has been checked, this method can be called. It will return the number of hits this message incurred. $num = $status->get_required_hits () After a mail message has been checked, this method can be called. It will return the number of hits required for a mail to be consid- ered spam. $report = $status->get_report () Deliver a "spam report" on the checked mail message. This contains details of how many spam detection rules it triggered. The report is returned as a multi-line string, with the lines separated by " " characters. $status->rewrite_mail () Rewrite the mail message. This will add headers, and possibly body text, to reflect its spam or not-spam status. The modifications made are as follows: Subject: header for spam mails The string "*****SPAM*****" (changeable with "subject_tag" config option) is prepended to the subject, unless the "rewrite_subject 0" configuration option is given. X-Spam-Status: header for spam mails A string, "Yes, hits=nn required=nn tests=..." is set in this header to reflect the filter status. The keys in this string are as follows: X-Spam-Report: header for spam mails The SpamAssassin report is added to the mail header if the "report_header 1" configuration option is given. hits=nn The number of hits the message triggered. required=nn The threshold at which a mail is marked as spam. tests=... The symbolic names of tests which were triggered. X-Spam-Flag: header for spam mails Set to "YES". Content-Type: header for spam mails Set to "text/plain", in order to defang HTML mail or other active content that could "call back" to the spammer. X-Spam-Checker-Version: header for spam mails Set to the version number of the SpamAssassin checker which tested the mail. spam mail body text The SpamAssassin report is added to top of the mail message body, unless the "report_header 1" configuration option is given. X-Spam-Status: header for non-spam mails A string, "No, hits=nn required=nn tests=..." is set in this header to reflect the filter status. The keys in this string are the same as for spam mails (see above). $messagestring = $status->get_full_message_as_text () Returns the mail message as a string, including headers and raw body text. If the message has been rewritten using "rewrite_mail()", these changes will be reflected in the string. Note: this is simply a helper method which calls methods on the mail message object. It is provided because Mail::Audit uses an unusual (ie. not quite intuitive) interface to do this, and it has been a common stumbling block for authors of scripts which use Spa- mAssassin. $status->finish () Indicate that this $status object is finished with, and can be destroyed. If you are using SpamAssassin in a persistent environment, or checking many mail messages from one Mail::SpamAssassin factory, this method should be called to ensure Perl's garbage collection will clean up old status objects. SEE ALSO
"Mail::SpamAssassin" "spamassassin" perl v5.8.0 2002-09-26 Mail::SpamAssassin::PerMsgStatus(3)
All times are GMT -4. The time now is 04:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy