RE: counting emails and pine questions

2002-12-29 Thread linux_il
It's a standard trick :-)

Messages in these files are separated by From  lines (notice the space).
Why do you use less?  You can supply the file name to grep:

egrep -c '^From ' /var/spool/mail/USERNAME

I'm not familiar with pine.  Have you checked it's docs?  It sounds like
a trivial question.

Cheers,

--Amos

 -Original Message-
 From: Ishai Parasol
 [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, December 29, 2002 10:26 AM
 To: [EMAIL PROTECTED]
 Subject: counting emails and pine questions
 
 
 Hi
 
 I'm looking for a way to know (using the command line) the 
 number of emails
 that a /var/spool/mail/USERNAME file contains. Right now I'm 
 using less
 /var/spool/mail/USERNAME | grep -c Subject:  , but it's not 
 accurate enough
 (cases of forwarded mails etc.). Any better ideas ?
 
 Another question. Is it possible to run pine with another 
 user email file
 (/var/spool/mail/USER) ?  for example, I'm logged as root and 
 want to read
 USER2 emails (ofcourse, USER2 can't login, he's only a mail 
 account and not
 a full user). If it's impossible with pine, is there a 
 client (not for X)
 that can do it ?
 
 Thanks,
 Ishai.
 
 
 
 =
 To unsubscribe, send mail to [EMAIL PROTECTED] with
 the word unsubscribe in the message body, e.g., run the command
 echo unsubscribe | mail [EMAIL PROTECTED]
 
 
 
 -- Your email is protected by Mailshell -- 
 As you requested, this email was forwarded to you by Mailshell.
 Mailshell will forward your replies to this email and keep your
 private email address safe.
 
 To unsubscribe safely and easily using Mailshell or to stop 
 forwarding:
 http://www.mailshell.com/control.html?a=blshp8bbumg87yq1j9157q
v2pz6_58z35eg0

FreshAddress.com http://rd.mailshell.com/ad482
Earn up to $3 for each of your friends who signs up with Mailshell!
http://rd.mailshell.com/sp5

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]




Re: counting emails and pine questions

2002-12-29 Thread Muli Ben-Yehuda
On Sun, Dec 29, 2002 at 10:25:47AM +0200, Ishai Parasol wrote:

 I'm looking for a way to know (using the command line) the number of emails
 that a /var/spool/mail/USERNAME file contains. Right now I'm using less
 /var/spool/mail/USERNAME | grep -c Subject:  , but it's not accurate enough
 (cases of forwarded mails etc.). Any better ideas ?

You can use one of the many mbox reading libraries out there. I worked
with the python one and it's very convenient to use. Another option is
to look for a blank line followed by 'From xxx', which seems to be
unique in my mbox file. 

See also: http://www.everything2.com/index.pl?node_id=1096280

 Another question. Is it possible to run pine with another user email file
 (/var/spool/mail/USER) ?  for example, I'm logged as root and want to read
 USER2 emails (ofcourse, USER2 can't login, he's only a mail account and not
 a full user). If it's impossible with pine, is there a client (not for X)
 that can do it ?

No idea about pine, I don't use that *expletive*, but mutt can
certainly do it.
-- 
Muli Ben-Yehuda

The speed of light really is too slow nowdays. -- Alan Cox 

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]




Re: counting emails and pine questions

2002-12-29 Thread guy keren

On Sun, 29 Dec 2002, Ishai Parasol wrote:

 Another question. Is it possible to run pine with another user email file
 (/var/spool/mail/USER) ?  for example, I'm logged as root and want to read
 USER2 emails (ofcourse, USER2 can't login, he's only a mail account and not
 a full user). If it's impossible with pine, is there a client (not for X)
 that can do it ?

pine -f ../../../../../var/spool/mail/USER2

pine's -f flag interprets its argument relative to the user's 'Mail' (or 
'mail') directory - hence the need to use these '../' things. note that if 
you use '..' from the '/' directory, you remain in the root directory - so 
you can always use more '../' things, without getting errors.

-- 
guy

For world domination - press 1,
 or dial 0, and please hold, for the creator. -- nob o. dy


=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]




Re: counting emails and pine questions

2002-12-29 Thread Tzafrir Cohen
On Sun, 29 Dec 2002, guy keren wrote:


 On Sun, 29 Dec 2002, Ishai Parasol wrote:

  Another question. Is it possible to run pine with another user email file
  (/var/spool/mail/USER) ?for example, I'm logged as root and want to read
  USER2 emails (ofcourse, USER2 can't login, he's only a mail account and not
  a full user). If it's impossible with pine, is there a client (not for X)
  that can do it ?

 pine -f ../../../../../var/spool/mail/USER2

 pine's -f flag interprets its argument relative to the user's 'Mail' (or
 'mail') directory - hence the need to use these '../' things. note that if
 you use '..' from the '/' directory, you remain in the root directory - so
 you can always use more '../' things, without getting errors.

an absulute path will also work. In case of an absulute path, the imap
library (which pine uses) will simply take the absulute path of the file.

Try 'pine -f /etc/passwd'

-- 
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir



=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]




Re: counting emails and pine questions

2002-12-29 Thread Shaul Karl
On Sun, Dec 29, 2002 at 10:25:47AM +0200, Ishai Parasol wrote:
 Hi
 
 I'm looking for a way to know (using the command line) the number of emails
 that a /var/spool/mail/USERNAME file contains. Right now I'm using less
 /var/spool/mail/USERNAME | grep -c Subject:  , but it's not accurate enough
 (cases of forwarded mails etc.). Any better ideas ?
 


/tmp$ from -h
from: invalid option -- h
usage: from [-c] [-f file] [-s sender] [user]
/tmp$ 

 -c will merely give you the count.
 user will run it on that user mailbox. You do need permissions.


I know nothing about your your 2nd question.


 Another question. Is it possible to run pine with another user email file
 (/var/spool/mail/USER) ?  for example, I'm logged as root and want to read
 USER2 emails (ofcourse, USER2 can't login, he's only a mail account and not
 a full user). If it's impossible with pine, is there a client (not for X)
 that can do it ?
 
 Thanks,
 Ishai.
 
 
 
 =
 To unsubscribe, send mail to [EMAIL PROTECTED] with
 the word unsubscribe in the message body, e.g., run the command
 echo unsubscribe | mail [EMAIL PROTECTED]
 

-- 

Shaul Karl, [EMAIL PROTECTED] e t

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]