Line breaks in mail spool


 
Thread Tools Search this Thread
Operating Systems Linux Line breaks in mail spool
# 1  
Old 08-06-2015
Line breaks in mail spool

Hi,

I have an issue with the line breaks in the mail spool- /var/mail/user1. I have set up a script to go through the mail spool on one of the users and parse some parts of the mail, however there doesn't seem to exist the regular line endings CR, LF or both in the lines and this is breaking my script. The mails are sent from a java application to a POP3 account on exchange 2013 server and then I pull them with fetchmail and use postfix on the local server as MDA.
Actually the issue comes from the fact that there is 78 characters line wrapping of the plain text mail body, which breaks the lines and cannot grep correctly- I then tried to remove the line breaks with sed, but since I cannot find the new line character that is used I cannot replace it with sed. Any ideas on on how to find what new line char is used or how to remove the line wrapping from the body would be much appreciated.
# 2  
Old 08-06-2015
a sample/representative block of data and the desired output would help. Of course using the code tags...
# 3  
Old 08-07-2015
Hi,

Below is the data sample. The first line ends with the equal sign, so I need to remove the equal sign together with the EOL character. Generally when I view this mail in Outlook it looks fine and the line is displayed as without breaks.

Code:
The workflow with ID "TestJob-xxxxxxxxxxxxxxx" finished with status "FINISH=
ED_ERROR" on Site "Site-1".
The components finished with the following statuses:
StandardComponents-Import: FINISHED_ERROR


Last edited by Don Cragun; 08-07-2015 at 08:16 AM.. Reason: Change ICODE tags to CODE tags.
# 4  
Old 08-07-2015
Not sure I fully understand the problem, but for removing the undesired line break try
Code:
sed '/=\r*$/ {N;s/=\r*\n//}' file
The workflow with ID "TestJob-xxxxxxxxxxxxxxx" finished with status "FINISHED_ERROR" on Site "Site-1".
.
.
.

This User Gave Thanks to RudiC For This Post:
# 5  
Old 08-07-2015
Hi RudiC,

That's exactly what I was looking for. Thank you very much.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Page breaks and line breaks

Hi All, Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement . Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks . We have... (4 Replies)
Discussion started by: Ayaskant
4 Replies

2. AIX

/var/spool/mail/ issues

Hi My box is running with AIX 6100-06 and Im the root user of this box My /var gets filled up often to 100% When I investigate I find that it is the below file which increases rapidly /var/spool/mail/pdgadmin I dont know why this file is growing up. Can any one assist me on this.... (2 Replies)
Discussion started by: samsungsamsung
2 Replies

3. UNIX for Advanced & Expert Users

Mail going to /var/spool/mqueue instead of being sent

Hello, I have a bunch of cron jobs in the crontab. For some reason mail from the cron jobs started going to /var/spool/mqueue instead of being sent. Does anyone know why mail from cron jobs would go to the queue instead of being sent? (9 Replies)
Discussion started by: xadamz23
9 Replies

4. UNIX for Dummies Questions & Answers

/var/spool/mail

Hi, How can i get my mail on either /var/spool/mail or /var/mail? I use mail and sendmail command to send mail. But everytime I send mail it comes to my outlook inbox and when I check with mail command I get the message "No mail for siba". (Note siba is my user Id.) (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

5. UNIX for Dummies Questions & Answers

Sendmail /VAR/SPOOL/MAIL

Hi, First Question: In our company our users have their mailboxes in /var/spool/mail When I look at the users file it seems as if every email sent/received is in that user file! Is this because IMAP is being used or is that just how sendmail works? Second Question: How is that when I create... (3 Replies)
Discussion started by: mojoman
3 Replies

6. UNIX for Dummies Questions & Answers

/VAR/SPOOL/MAIL question

Hi, We have all the user account in a home direcory where their mail is stored and retrieved by email clients. We do however have /var/spool/mail with all the user accounts in it as well Our sendmail.cf is configured to use /var/spool/mqueue as the queue so .what is /var/spool/mail being used... (3 Replies)
Discussion started by: mojoman
3 Replies

7. UNIX for Dummies Questions & Answers

How do I read mail in /var/spool/mail?

How can I read mail sent to /var/spool/mail? I do not have pine installed so forget about that...is there some generic utility I can use? (3 Replies)
Discussion started by: mojoman
3 Replies

8. UNIX for Dummies Questions & Answers

Can I zero var/spool/mail/mail

The mail file in the directory var/spool/mail is very large. Can I zero this (>) without losing any unopened mails there may be? There are about 10 mail accounts. Using RedHat Linux. Thanks in advance. (0 Replies)
Discussion started by: dennisheazle
0 Replies

9. Shell Programming and Scripting

PHP Script that sends mail - Postfix breaks it

I have a PHP Script that works perfectly on a server that uses Sendmail. However I tried to port it to a new server that has the Postfix to Sendmail compatibility interface, and it doesn't work properly. The php.ini file has the path for sendmail on both servers set to: /usr/sbin/sendmail -t... (0 Replies)
Discussion started by: boopfm523
0 Replies

10. UNIX for Dummies Questions & Answers

in var/spool/mail, same entry with different users....

i am on aix, in the /var/spool/mail ,i have an entry as below, after doing a ls -ltr -rw-rw---- 1 ai mail 3898 Sep 02 11:26 mei -rw-rw---- 1 root mail 22900 Nov 08 14:55 root shouldnt the ai and mei be the same just like root, root? thanks (2 Replies)
Discussion started by: yls177
2 Replies
Login or Register to Ask a Question