11-17-2005
Great idea. I like the mschwage's suggestion. I used to use the \/ method, but now I will change to mschwage's default-changing method :-)
Thanks for the contribution. I love it when I learn something new here on UNIX.COM!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi
I'm trying to split a dir listing
eg
/home/foo1/foo2
I'm using ksh
I've tried
dir=/home/foo1/foo2
splitit=`echo $dir | awk -F '\/' '{print $1}'`
echo $splitit
nothing is output!
I have checked the escape character. The only one I have found is \
BTW `pwd` | awk -F \/... (8 Replies)
Discussion started by: OFFSIHR
8 Replies
2. Shell Programming and Scripting
Hi ,
I want to change space to ' in my script.
I tried doing this,
sed 's/ /\'/g' filename
but i could not get it.
can some one help me please.
Thanks,
Deepak (4 Replies)
Discussion started by: deepakpv
4 Replies
3. Shell Programming and Scripting
Hello,
I wanted to display command with echo like this in tcsh.
output should be "//'test.test1.test2'"
(" at both ends also required in output)
Please help me. (1 Reply)
Discussion started by: balareddy
1 Replies
4. Shell Programming and Scripting
Hi All,
How do i write in sed for the 6th and 7th field of etc/passwd file as it involves "/" character?
Does mine below is correct? It's incomplete script as i need help with syntax as i always getting may errors :(
Example of etc/passwd file:
blah:x:1055:600:blah... (6 Replies)
Discussion started by: c00kie88
6 Replies
5. Shell Programming and Scripting
Hello experts
I am trying to write a shell script which will add ' ' to a unix variable and then pass it to oracle for inserting to a table.
I am running the script as root and I have to do a su -c .
The problem is the character ' is not recognised inside sed even after adding escape... (1 Reply)
Discussion started by: pvedaa
1 Replies
6. Shell Programming and Scripting
ll|awk '{print "INSERT INTO SCHEMA.TABLE_NAME VALUES (`"$9 "`,"$5");" }'
INSERT INTO SCHEMA.TABLE_NAME VALUES (``,);
INSERT INTO SCHEMA.TABLE_NAME VALUES (`TABLE_PARTITION_Y2010M03D06.dmp`,7923328);
INSERT INTO SCHEMA.TABLE_NAME VALUES (`TABLE_PARTITION_Y2010M03D06.log`,1389);
But I want ' in... (2 Replies)
Discussion started by: faruque.ahmed
2 Replies
7. Shell Programming and Scripting
All ,
i have input line as below .
abc\ , ewioweioi \,
and want the output as below removing the "\"
abc , ewioweioi ,
could anyone help me out (2 Replies)
Discussion started by: expert
2 Replies
8. Shell Programming and Scripting
I need to change a pattern with single quotes
# echo "serversignature: 'On'"
serversignature: 'On'
I did
# echo "serversignature: 'On'" | sed 's/.*serversignature.*/serversignature: 'Off'/'
serversignature: Off
The output I need is with single quotes. But its swallowing it.
... (2 Replies)
Discussion started by: anilcliff
2 Replies
9. Shell Programming and Scripting
friends,
I have a situation where i am using a $RANDOM function along with the filename, I want this to be escaped by the OS in the first assignment (works as expected) and executed in the second assignment (does not execute $RANDOM)
filename1=filename1_\$RANDOM
echo $filename1... (3 Replies)
Discussion started by: Balaji M
3 Replies
10. Shell Programming and Scripting
Hi ,
I am looking for a function which will do the following.
1. I have a variable which will hold few special chracter like
SPECIAL_CHARS="& ;"2. I have an escape character.
ESCAPE_CHAR="\"3. Now when I passed some string in the function it will return the same string but now it will... (8 Replies)
Discussion started by: Anupam_Halder
8 Replies
LEARN ABOUT SUSE
mail::spamassassin::client
Mail::SpamAssassin::Client(3) User Contributed Perl Documentation Mail::SpamAssassin::Client(3)
NAME
Mail::SpamAssassin::Client - Client for spamd Protocol
SYNOPSIS
my $client = new Mail::SpamAssassin::Client({
port => 783,
host => 'localhost',
username => 'someuser'});
or
my $client = new Mail::SpamAssassin::Client({
socketpath => '/path/to/socket',
username => 'someuser'});
Optionally takes timeout, which is applied to IO::Socket for the
initial connection. If not supplied, it defaults to 30 seconds.
if ($client->ping()) {
print "Ping is ok
";
}
my $result = $client->process($testmsg);
if ($result->{isspam} eq 'True') {
do something with spam message here
}
DESCRIPTION
Mail::SpamAssassin::Client is a module which provides a perl implementation of the spamd protocol.
PUBLIC METHODS
new
public class (Mail::SpamAssassin::Client) new (\% $args)
Description: This method creates a new Mail::SpamAssassin::Client object.
process
public instance (\%) process (String $msg)
Description: This method calls the spamd server with the PROCESS command.
The return value is a hash reference containing several pieces of information, if available:
content_length
isspam
score
threshold
message
check
public instance (\%) check (String $msg)
Description: The method implements the check call.
See the process method for the return value.
headers
public instance (\%) headers (String $msg)
Description: This method implements the headers call.
See the process method for the return value.
learn
public instance (Boolean) learn (String $msg, Integer $learntype)
Description: This method implements the learn call. $learntype should be an integer, 0 for spam, 1 for ham and 2 for forget. The return
value is a boolean indicating if the message was learned or not.
An undef return value indicates that there was an error and you should check the resp_code/resp_msg values to determine what the error was.
report
public instance (Boolean) report (String $msg)
Description: This method provides the report interface to spamd.
revoke
public instance (Boolean) revoke (String $msg)
Description: This method provides the revoke interface to spamd.
ping
public instance (Boolean) ping ()
Description: This method performs a server ping and returns 0 or 1 depending on if the server responded correctly.
PRIVATE METHODS
_create_connection
private instance (IO::Socket) _create_connection ()
Description: This method sets up a proper IO::Socket connection based on the arguments used when creating the client object.
On failure, it sets an internal error code and returns undef.
_parse_response_line
private instance (@) _parse_response_line (String $line)
Description: This method parses the initial response line/header from the server and returns its parts.
We have this as a separate method in case we ever decide to get fancy with the response line.
_clear_errors
private instance () _clear_errors ()
Description: This method clears out any current errors.
_filter
private instance (\%) _filter (String $msg, String $command)
Description: Makes the actual call to the spamd server for the various filter method (ie PROCESS, CHECK, HEADERS, etc). The command that
is passed in is sent to the spamd server.
The return value is a hash reference containing several pieces of information, if available:
content_length
isspam
score
threshold
message (if available)
perl v5.12.1 2010-03-16 Mail::SpamAssassin::Client(3)