Mail - stops listing after 34 lines with a "?"

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Mail - stops listing after 34 lines with a "?"
# 1  
Old 10-17-2017
Mail - stops listing after 34 lines with a "?"

Hope all is well with you and yours.

I have a quick unix/Linux mail question.

I need to get some data from all received mail and load it into the PostgreSQL DB. I use fetchmail to get them from a remote server and they go to /var/mail/abruck

There are 2 lines that I need from each email: Date and Subject.

When I just type "mail" to get the mail content, I get exactly what I want:

Code:
U 1 Dispatch Team Tue Oct 17 11:55 192/11778 (FOLLOW-UP) 1 - Emergency Work Order# WO-0003342 at (Ranch) | ETA NEEDED - CRM:01136317
U 2 Dispatch Team Tue Oct 17 11:55 289/18637 4 - Normal Work Order# WO-0003304 SCHEDULED for 8/8/2017 4:30 PM (Wents) - CRM:01136334
U 3 Dispatch Team Tue Oct 17 11:55 289/18637 4 - Normal Work Order# WO-0003304 SCHEDULED for 8/9/2017 4:00 PM (Wents) - CRM:01136338
......
U 33 Dispatch Team Tue Oct 17 11:55 187/11550 (FOLLOW-UP) 2 - Critical Work Order# WO-0002897 at (Calas) | ETA NEEDED - CRM:01136469
U 34 Dispatch Team Tue Oct 17 11:55 190/11725 (FOLLOW-UP) 1 - Emergency Work Order# WO-0003342 at (Ranch) | ETA NEEDED - CRM:01136473

?


except that it stops after 34 lines with a "?"

How can I get ALL the emails without stopping every 34 lines with a "?". I want go > it all into one file.

Greatly appreciate your time and efforts ...

All the Best!

Last edited by Scott; 10-17-2017 at 05:56 PM.. Reason: Please use code tags, and don't paste rich-text, it's a pain to tidy up. Thanks.
# 2  
Old 10-17-2017
/var/mail/abruck is a directory - the mail file(s) there are text files. You can list the file
with ls and view the file with vi.

So if you employ grep on the file to return just the lines you want from the file, you can get any set of values you need.

One weeny - fetchmail simply adds new emails to end of the mail text file.
The mail clients marks unread items as read. You are not using mail to read them anymore. Nothing gets marked as read.

If you want to see just the latest ones, rename that existing mail text file every business day to something else like mailfile_[yesterday's date] You can then go in the /var/mail/abruck directory and clean up old files by ancient dates on them. Then use touch to create a new files. You can also simply truncate the file if you do not care about older emails.
# 3  
Old 10-18-2017
Thank you for that.

I solved the issue (partly) with "mail -H" but:

When I do mail on the command line, I get:
Code:
abruck@abruck-LX6810-01:~$ mail
"/var/mail/abruck": 2610 messages 2610 unread
>U   1 Dispatch Team      Tue Oct 17 11:55 189/11578 (FOLLOW-UP) 2 - Critical Work Order# WO-0002897 at (Callaway Villas) | ETA NEEDED - CRM:01136292
 U   2 Dispatch Team      Tue Oct 17 11:55 208/12950 (FOLLOW-UP) 1 - Emergency Work Order# WO-0002643 at (The Gateway at Lubbock) | ETA NEEDED - CRM:01136294
 U   3 Dispatch Team      Tue Oct 17 11:55 191/11725 (FOLLOW-UP) 1 - Emergency Work Order# WO-0003342 at (River Ranch) | ETA NEEDED - CRM:01136299

and when I did mail -H, I get:

Code:
>U   1 Dispatch Team      Tue Oct 17 11:55 192/11778 (FOLLOW-UP) 1 - Emergency
 U   2 Dispatch Team      Tue Oct 17 11:55 289/18637 4 - Normal Work Order# WO
 U   3 Dispatch Team      Tue Oct 17 11:55 289/18637 4 - Normal Work Order# WO

Half the line is missing...

Any ideas?

Last edited by Scott; 10-18-2017 at 12:55 AM.. Reason: Code tags, please...
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

4. AIX

echo $varibla | mail -s "subject" "xxx@xxx.com" not ruuning as expected

Hi Folks, As per the subject, the following command is not working as expected. echo $variable | mail -s "subject" "xxx@xxx.com" Could anyone figure it out whats wrong with this. I am using AIX box. Regards, (2 Replies)
Discussion started by: gjarms
2 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies
Login or Register to Ask a Question