From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2537 invoked by alias); 13 Oct 2014 17:59:19 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19244 Received: (qmail 28433 invoked from network); 13 Oct 2014 17:59:08 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <141013105932.ZM6622@torch.brasslantern.com> Date: Mon, 13 Oct 2014 10:59:32 -0700 In-reply-to: <543C05F3.2020804@eastlink.ca> Comments: In reply to Ray Andrews "combine/merge .history?" (Oct 13, 10:03am) References: <20141002204012.0b884f9c@pws-pc.ntlworld.com> <542FFF6D.6080105@eastlink.ca> <141004084635.ZM6823@torch.brasslantern.com> <543C05F3.2020804@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: combine/merge .history? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 13, 10:03am, Ray Andrews wrote: } } Can we do simple cut/copy/paste operations in the .histfile? If you're using the EXTENDED_HISTORY option or features that rely on that format like shared/incremental history -- which it appears from your excerpt that you are -- then it's not entirely safe to edit the history by hand. I don't know of anything particular that will go wrong, especially if you only change it while no shells are running to access it, but you should not be surprised if the history state gets a little odd. However, you have a somewhat different case here: You have history files in two different formats that you want to combine. To do this you'll have to be careful to edit all entries into a single format. } the 'lead numbers' are so different: In the first example ... } 1390861257:0;mcedit lilo.conf } 1390861320:0;lilo -C /boot/lilo.conf } 1390861514:0;startxfce4 } 1390861527:0;modprobe nouveau ... those are timestamps [e.g. 1390861527 is Mon Jan 27 14:25:27 2014 (PST)] followed by durations in seconds that the command took to run (which always record as zero when sharing history, see the new option INC_APPEND_HISTORY_TIME). This example ... } 1074* c Boot } 1075* e zshrc } 1076* A } 1077* man pv ... doesn't look like anything zsh ever saved; those would appear to just be line numbers. When not using EXTENDED_HISTORY et al., zsh saves the commands without any leading prefix. Your best bet is probably to remove everything up to the first ";" from each line of the file with the timestamps, remove everything through "* " from each line of the other, then combine the two and try to read them into a "zsh -f" with "fc -R" (set HISTSIZE large enough first). If that works as you wanted, repeat the "fc -R" in a regular login shell and save with "fc -A".