Re: how to get mutt new mails' number
On Thu, Apr 12, 2012 at 10:43:24AM -0700, Chip Camden wrote: If you're using mbox format, then this ruby script will output the number of new messages in an mbox passed as an argument or piped to its stdin: #!/usr/bin/env ruby UNIX_FROM = /^From \S+ ([A-Z][a-z]{2} ){2}[\s\d]\d \d{2}:\d{2}:\d{2} \d{4}$/ For what it's worth, this may be too restrictive in practice, for the general case. I believe the generally accepted regex is: ^From .+ (that's ^From followed by SPC, followed by .+). The date format can be variable from client to client, and as we've seen on mutt-dev in the past IIRC, may be omitted entirely by some clients / MDAs. This is why most clients / MDAs will escape lines that start with From or use quoted-printable to encode messages containing them. Sadly there is no official standard which defines what should be in the From line which starts an mbox message, as there is no single formal standard for mbox message stores (there is RFC 4155, which is NOT for message stores -- otherwise you get whatever your vendor decided to implement). -- Derek D. Martinhttp://www.pizzashack.org/ GPG Key ID: 0xDFBEAD02 -=-=-=-=- This message is posted from an invalid address. Replying to it will result in undeliverable mail due to spam prevention. Sorry for the inconvenience. pgpEn9AUNmwmU.pgp Description: PGP signature
how to get mutt new mails' number
Hi,all I am a newcomer to mutt, Is there any method to show that how many new mails and how many mails in all in my mailboxs i read the mutt manual ,but i can not find a command to get the result! for example, i have a inbox call gmail, in it, there has 15 new mails and 30 mails in all, then i want a mutt command to return the numbers and let other shell command use it!
Re: how to get mutt new mails' number
Quoth vinurs on Thursday, 12 April 2012: Hi,all I am a newcomer to mutt, Is there any method to show that how many new mails and how many mails in all in my mailboxs i read the mutt manual ,but i can not find a command to get the result! for example, i have a inbox call gmail, in it, there has 15 new mails and 30 mails in all, then i want a mutt command to return the numbers and let other shell command use it! If you're using mbox format, then this ruby script will output the number of new messages in an mbox passed as an argument or piped to its stdin: #!/usr/bin/env ruby UNIX_FROM = /^From \S+ ([A-Z][a-z]{2} ){2}[\s\d]\d \d{2}:\d{2}:\d{2} \d{4}$/ newmail=0 in_hdr=false $.each do |line| case line when UNIX_FROM newmail += 1 in_hdr = true when /^Status: RO/ newmail -= 1 if in_hdr when /^\s*$/ in_hdr = false end end puts newmail -- .O. | Sterling (Chip) Camden | http://camdensoftware.com ..O | sterl...@camdensoftware.com | http://chipsquips.com OOO | 2048R/D6DBAF91 | http://chipstips.com pgphiT68bnRUJ.pgp Description: PGP signature
Re: how to get mutt new mails' number
* vinurs schrieb am 12. Apr. 2012: I am a newcomer to mutt, Is there any method to show that how many new mails and how many mails in all in my mailboxs i read the mutt manual ,but i can not find a command to get the result! for example, i have a inbox call gmail, in it, there has 15 new mails and 30 mails in all, then i want a mutt command to return the numbers and let other shell command use it! lsmbox - list number of total, old unread, and new messages for the specified mailbox(es) http://ftp.de.debian.org/debian/pool/main/l/lsmbox/lsmbox_2.1.2.orig.tar.gz Andreas
Re: how to get mutt new mails' number
Chip Camden wrote: Quoth vinurs on Thursday, 12 April 2012: ... i have a inbox call gmail... If you're using mbox format... Snipped for clarity.