I have a text file which contains email headers and its value. looks like below:
X-Originating-IP: [141.12.67.171]
X-EIP: [WrrdRE5IHzynFRch2UnizIKJ909XPTq5]
X-Originating-Email: [reva.reva.reva@hotmail.com]
Message-ID: <SNT139-W588104AB227AA9D1E443ABCF540@phx.gbl>
Content-Type: multipart/mixed;
boundary="_ee82adcf-0995-439f-a6dc-4386dadf9660_"
From: Reva Patil <reva.reva.reva@hotmail.com>
To: <mueller.reva@yahoo.de>
Subject: Hotmail
Date: Wed, 21 Nov 2012 12:34:46 +0000
Importance: Normal
MIME-Version: 1.0
X-OriginalArrivalTime: 21 Nov 2012 12:34:47.0075 (UTC) FILETIME=[976F7F30:01CDC7E4]
I have noticed that in the line which starts from “From:” (with winmerge file comparing tool), there are white spaces before a newline. I would like to remove it. Actually I would like to remove all white spaces before each newline in a file. I have already gone through the posted question here : removing space before new line in java
But that did not help me unfortunately.
I would appreciate any advices to do this in java.
Thank you all for your responses.
Finally I could found regular expression which removes all white spaces (including non breaking white space) from a string.