zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: combine/merge .history?
Date: Mon, 13 Oct 2014 10:59:32 -0700	[thread overview]
Message-ID: <141013105932.ZM6622@torch.brasslantern.com> (raw)
In-Reply-To: <543C05F3.2020804@eastlink.ca>

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".


  reply	other threads:[~2014-10-13 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 19:40 Trial for 5.0.7 Peter Stephenson
2014-10-04 14:08 ` Ray Andrews
2014-10-04 15:46   ` Bart Schaefer
2014-10-04 21:29     ` Ray Andrews
2014-10-08 20:06     ` Ray Andrews
2014-10-08 22:24       ` Bart Schaefer
2014-10-13 17:03     ` combine/merge .history? Ray Andrews
2014-10-13 17:59       ` Bart Schaefer [this message]
2014-10-13 20:33         ` Ray Andrews
2014-10-13 21:33           ` Bart Schaefer
2014-10-13 21:58             ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=141013105932.ZM6622@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).