LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-06-2007, 10:33 PM   #1
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Rep: Reputation: 30
FIle Overwriting


Hi ,
I have backed up my clients mailbox /var/spool/mail/client as client1. After i finish re-builing the sendmail config , i want to restore the backed file. But i found that the spooling starts and the new inbox start growing.
Is there a way to overwrite client with client1 without clearing the contents of client.
I mean append client with client1.

Thanks in Advance.
 
Old 08-07-2007, 03:21 PM   #2
winfinit
Member
 
Registered: Jul 2006
Location: FL, Delray Beach
Distribution: Slackware11, LFS
Posts: 67

Rep: Reputation: 15
if i understand correctly you are trying to append info from client1 to client

not sure how fast and how large your lof file is, but you should be able to do everything through cat and embedding commands, and if log file is not large, then you will not miss any data


cat client1 client >> client3 && mv client client.BACKUP && mv client3 client
you can also do same thing with sed, do man on it for right syntax.

if it is not what you are trying to do please correct me.
 
Old 08-08-2007, 01:09 AM   #3
ZAMO
Member
 
Registered: Mar 2007
Distribution: Redhat &CentOS
Posts: 598

Original Poster
Rep: Reputation: 30
Yes you are correct. The purpose is to finally append the files, but as it is a mail box , i don't want mails ton repeat. can you tell me while i append
cat client1 client >> client3 && mv client client.BACKUP && mv client3 client
Shall i get no duplicate mails. I mean during append, i want the contents of files(whichever file it may be) must not be duplicated??
Waiting for your reply??
 
Old 08-08-2007, 10:46 AM   #4
winfinit
Member
 
Registered: Jul 2006
Location: FL, Delray Beach
Distribution: Slackware11, LFS
Posts: 67

Rep: Reputation: 15
if both of your mailboxes not containing duplicate information, then you will not receive duplicates, however if they are containing duplicates then you have to filter your mailbox to remove them, also if you are working with a mailbox file it has a From line that is starting a message and each message is separated by a single blank line, once you will cat those 2 files together it is not going to add that line for you, so you will recieve a currupted mailbox file or a message, so before you do that, make sure to add a blank line to the end of a first file, before putting both of the files together. (or you can add a blank line to your sencond message, but it will have to be at the beginning of your spool file) that way you will avoid that curruption.

if you need something to filter your mailbox for a duplicated let me know i think i had a script somewhere that can do that for you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy without overwriting [KIA]aze Linux - Newbie 4 03-08-2007 07:42 AM
Overwriting a linux distro sfzab Linux - Software 1 04-23-2006 02:51 PM
Arrays overwriting variables in c george_mercury Programming 4 12-31-2004 06:20 AM
How do I redirect something to a file without it overwriting the destination file??? nikold01 Linux - General 8 09-09-2004 02:30 PM
Windows Overwriting MBR Need help.. Nukem Linux - General 2 04-07-2004 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration