mailx- how to delete least of mails


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mailx- how to delete least of mails
# 1  
Old 01-30-2012
mailx- how to delete least of mails

Hi,


when i run the
Code:
  mailx

command it gives me the least of mails . suppose there are 1- 150 mails and i want to delete 30 to 145 mails . then what command i have to use here?

Thanks
# 2  
Old 01-30-2012
'd' command to delete mails, once you are inside mailx (mode) command.
else view 'mbox' file (using vi) in home directory and delete lines '145dd'.

PS: all mails are stored in 'mbox' file at /home/<user>/
mails usually gets deleted once you have read it....unless the SET KEEP option is set.
# 3  
Old 01-30-2012
Quote:
Originally Posted by aish11
Hi,


when i run the
Code:
  mailx

command it gives me the least of mails . suppose there are 1- 150 mails and i want to delete 30 to 145 mails . then what command i have to use here?

Thanks
Code:
& d 30-145

# 4  
Old 01-30-2012
Hi ygemici,


i tried
Code:
 d 30-145

inside mailx command


but when i am entering the again 145 inside mailx command , i am able to see the mail.
# 5  
Old 01-30-2012
Changes in "mailx" are deferred until the end of the session. The messages were just marked "deleted". There is even an "undelete" while you are still in the session.
How you exit "mailx" matters. See the difference between "x" and "q".
# 6  
Old 01-30-2012
hi methyl,

i am not getting what you want to say here. can you please explain me in different way.

Thanks in advance
# 7  
Old 01-30-2012
During your mailx interactive session in your example the mail is not actually deleted until you leave the session. Even then it is only deleted if you leave the session with the "q" (quit) command not the "x" (exit) command.
However you should have had the error message "Inappropriate message" when trying to look at message 145 after deleting it.
This User Gave Thanks to methyl For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Mailx command running successfully but no mails received.

Hi, I am working on a HP-UX box. Mailx command running successfully but no mails received. Here is what I am doing rocfm@comhp73 - mailx -s "subject" abc@gmail.com < abc.txt Null message body; hope that's ok rocfm@comhp73 - echo $? 0 rocfm@comhp73 - echo "something" | mailx -v -s... (1 Reply)
Discussion started by: Sunayna
1 Replies

2. IP Networking

Set default return address for all mails sent from mailx

Hi, I have a question about mailx in Red Hat: If I use 'mail userid@mydomain.com -- -f root@mydomain.com', the return mail address will be root@mydomain.com. How can I make all mails sent from this system use root@mydomain.com as return address by default? Thank you in advance! nz (1 Reply)
Discussion started by: aixlover
1 Replies

3. Shell Programming and Scripting

2 mails from mailx command

hi, While using mailx command i am receiving 2 mails with the same content in both the mails.I am attaching a file to the mailx command. In one mail file is coming as attachement and in other attachment is not there. I am using mailx command in this way. echo "Some content" |mailx... (0 Replies)
Discussion started by: arijitsaha
0 Replies

4. Solaris

Delete clientmqueue mails

My clientmqueue directory is almost 6.7GB. There are like a thousands of e-mail that are present. Is there any way to delete them or just delete them normally. Also while deleting them, do i need to shutdown my sendmail service? Root FS is almost at 100%. Please help in this. Thanks in... (1 Reply)
Discussion started by: aksijain
1 Replies

5. UNIX for Dummies Questions & Answers

Delete all mails on Solaris

How do I delete all my mails in the mailbox on Solaris? $mail ? d * Illegal numeric ? d * does not work. Also I want to retain the mailbox. Thanks, Rahul. (3 Replies)
Discussion started by: rahulrathod
3 Replies

6. Shell Programming and Scripting

mailx is not working outside e-mails

HI i wrote schell script to send e-mail automatically. it works only e-mail for our company.say for example, company name is : abc, example: joe@abc.com every body is receiving with xxx@abc.com (abc.com) if any body from outside of our company like joe@xyz.com.(xyz.com) are not... (3 Replies)
Discussion started by: raosurya
3 Replies

7. Shell Programming and Scripting

Delete all mails using mailx or mail

Hi , ?im a newbie using shell scripts. Is there any way to write a script that will delete all mails from my mailbox using mail or mailx command Thanks for your time E. Festas (2 Replies)
Discussion started by: ninjanesto
2 Replies

8. Debian

cannot send any mails using mailx

hi howto configure mailx ? kind regards ccc (11 Replies)
Discussion started by: ccc
11 Replies

9. UNIX for Dummies Questions & Answers

Does Mailx store the mails sent

Hi, I use mailx in a shell script to mail a message to the users. i wanted to know if mailx stores the mail that it sends? for eg in microsoft outlook all mails sent get stored in the outbox. is there such a facility with mailx? if not how i can do this so that for every mail sent, a backup... (6 Replies)
Discussion started by: munira_johar
6 Replies

10. Solaris

how to send mails to users on exchange server from sendmail/solaris(mailx)

Hi, Can anyone pls. tell me how to access Active directory from solaris. I am looking at solution by which I can send mail notification from the logs generated by scripts, to the users on Exchange server. I am trying for a Perl-LDAP module , but don't realy know how to go for it (5 Replies)
Discussion started by: ganeshh
5 Replies
Login or Register to Ask a Question