Sponsored Content
Top Forums Shell Programming and Scripting Mail cleanup from ksh script, keeping 50 most recent msgs Post 302369023 by OPTIMUS_prime on Friday 6th of November 2009 09:12:25 AM
Old 11-06-2009
More detail provided

For example, if I have 3 messages in my system mailbox, and I read one and exit mailx, I see these messages:
Saved 1 message in /home/users/tiger/mbox
Held 2 messages in /var/spool/mail/tiger
I would like to clean up /var/spool/mail/tiger (leaving most recent 50 messages) without putting anything in /home/users/tiger/mbox. Alternatively, I could completely clean out /var/spool/mail/tiger and put the 50 most recent messages into /home/users/tiger/mbox.

Whichever is easier, I'm not choosy.

Thanks for your time and assistance.

Last edited by OPTIMUS_prime; 12-08-2009 at 04:33 PM.. Reason: corrected spelling
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk/sed/ksh script to cleanup /etc/group file

Many of my servers' /etc/group file have many userid's that does not exist in /etc/passwd file and they need to be deleted. This happened due to manual manipulation of /etc/passwd files. I need to do this for 40 servers. Can anyone help me in achieving this? Even reducing a step or two will be... (6 Replies)
Discussion started by: pdtak
6 Replies

2. Shell Programming and Scripting

User Cleanup Script

Hi Guys, I've got an system setup to act as an sftp server. I have a script that allows me to create chroot users running a custom shell within their home directory, it also creates a subdirectory that they can write into. I'm trying to write a script (that I can cron at a later date) that checks... (3 Replies)
Discussion started by: King_Brucie
3 Replies

3. Shell Programming and Scripting

Cleanup script

Hi! I would like to write a script which remove some files, all beginning with the same prefix : prefix.1 doc/prefix.2 ../prefix.3 etc. So, I would create a file and chmod it executable. But I dont know how to pass a variable to a script. I would like to write something like ... (2 Replies)
Discussion started by: tipi
2 Replies

4. Shell Programming and Scripting

ksh scripting: Extract 1 most recent record for unique key

I'm loading multiple delimited files into an Oracle DB using sqlldr on Unix. I would like to get only the most recent record per each unique key. There may be multiple updates for each key, but I only want the most recent one. There is a date column in my delimited files, so I'm using cat to... (2 Replies)
Discussion started by: OPTIMUS_prime
2 Replies

5. Shell Programming and Scripting

Calling SQL script from ksh job and send mail on some error.

Hi, I am trying to call sql script from ksh job with parameters.The parameters passed from ksh job will be used in SELECT query in sql file to SPOOL the data in extract file.My questions are: 1) How to call a sql script from ksh job with parameters? 2) How to use the parameter in sql file to... (1 Reply)
Discussion started by: anil029
1 Replies

6. UNIX for Advanced & Expert Users

Table Cleanup Script

I needed some help with a script to fetch and delete all records prior to 3 days from now connecting to sybase from sunos. I wrote the following script but not working..can someone please guide me with my code. Thanks #!/bin/ksh ##GET PREVIOUS DAY DATE dt=`date | awk... (3 Replies)
Discussion started by: moe458
3 Replies

7. Shell Programming and Scripting

pid.cleanup script.

Hi guys! I have a directory in the production environment from which i have to delete files older then 40 minutes with .pid extention. I wrote a script below for the purpose. #!/bin/bash # # Script to delete specific file older than N minutes. # OLDERTHAN="40" #40 minutes ... (6 Replies)
Discussion started by: sajid.shah
6 Replies

8. Shell Programming and Scripting

recent test -e ksh incompatibility in hpux?

On a very new (11.31) hpux machine, I can no longer execute shell fragements like: if ; then . .profile.foo fi and get "ksh: test: argument expected" if I convert this to -d or -f as appropriate (which I've not had to do on older versions of hpux (11.23) nor any other unix platform... (9 Replies)
Discussion started by: Peeter Joot
9 Replies

9. Shell Programming and Scripting

AIX .ksh script freezes when using the mail -s command

Hello I am trying to send an email when a .KSH script is run on an AIX Machine. This email will only include a subject line that is made up of variables from within the script, and is as follows: CURRENT_DATE=`date +%Y%m%d` TIME=`date` ADMIN="myname@domain.com" date block () { ... (4 Replies)
Discussion started by: jimbojames
4 Replies

10. Shell Programming and Scripting

Ksh Searching for a string within a file and keeping a count= get the following Sample01=: command

I have a script that goes through a 24 hr logfile, And i want to count the instances of a Test01 to 83 and output the sum of all the instances over 24hrs #/bin/ksh cat $parse_data | awk '/'$time$i'/ {for(x=0; x<=16; x++) {getline; print}print "--" }' > _hr.txt for... (2 Replies)
Discussion started by: k00061804
2 Replies
IMAP_FETCH_OVERVIEW(3)							 1						    IMAP_FETCH_OVERVIEW(3)

imap_fetch_overview - Read an overview of the information in the headers of the given message

SYNOPSIS
array imap_fetch_overview (resource $imap_stream, string $sequence, [int $options]) DESCRIPTION
This function fetches mail headers for the given $sequence and returns an overview of their contents. PARAMETERS
o $ imap_stream -An IMAP stream returned by imap_open(3). o $sequence - A message sequence description. You can enumerate desired messages with the X,Y syntax, or retrieve all messages within an interval with the X:Y syntax o $options -$sequence will contain a sequence of message indices or UIDs, if this parameter is set to FT_UID. RETURN VALUES
Returns an array of objects describing one message header each. The object will only define a property if it exists. The possible proper- ties are: o subject - the messages subject o from - who sent it o to - recipient o date - when was it sent o message_id - Message-ID o references - is a reference to this message id o in_reply_to - is a reply to this message id o size - size in bytes o uid - UID the message has in the mailbox o msgno - message sequence number in the mailbox o recent - this message is flagged as recent o flagged - this message is flagged o answered - this message is flagged as answered o deleted - this message is flagged for deletion o seen - this message is flagged as already read o draft - this message is flagged as being a draft EXAMPLES
Example #1 imap_fetch_overview(3) example <?php $mbox = imap_open("{imap.example.org:143}INBOX", "username", "password") or die("can't connect: " . imap_last_error()); $MC = imap_check($mbox); // Fetch an overview for all messages in INBOX $result = imap_fetch_overview($mbox,"1:{$MC->Nmsgs}",0); foreach ($result as $overview) { echo "#{$overview->msgno} ({$overview->date}) - From: {$overview->from} {$overview->subject} "; } imap_close($mbox); ?> SEE ALSO
imap_fetchheader(3). PHP Documentation Group IMAP_FETCH_OVERVIEW(3)
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy