On 30 Sep 17:39, Mark Rogers wrote:
On 23/09/10 11:00, Mark Rogers wrote:
I need to go through a text file, and for all lines similar to this: X-Mozilla-Status: 0009 .. I need to unset the 4th bit (so the above becomes 0001).
Just to follow-up on this:
I didn't find a good solution, but did find out that I could remove all the X-Mozilla-Status: lines and Thunderbird was happy with the resulting file, it just had everything marked unread and undeleted.
To remove the lines I used: grep -v 'X-Mozilla-Status:' mailbox > mailbox.tmp mv mailbox.tmp mailbox
Why couldn't you have just done: sed -i -e 's#^X-Mozilla-Status: 0009$#X-Mozilla-Status: 0001#;' mailbox
An inplace replacement of the line with the fixed line.
Cheers,