Discussion:
How can I copy the last few lines of pane history programmatically?
Kaushal
2015-01-15 21:49:59 UTC
Permalink
Hi,

Here is the use case.

After I run a certain program, at the end that program outputs something
like:

*Log location: /path/to/the/log/some_file_random_seed.txt*

I would like a write a little shell script to parse the last, let's say, 20
lines in the tmux history and be able to 'cd' to that log location or open
that log in a chosen editor.

But to begin with, I am unable to find a way to copy the last few lines of
the current pane history using a script.

Is it possible to do so?

Thanks.


--
Kaushal Modi
Thomas Adam
2015-01-15 21:53:35 UTC
Permalink
Post by Kaushal
But to begin with, I am unable to find a way to copy the last few lines of
the current pane history using a script.
capture-pane

-- Thomas Adam
Kaushal
2015-01-15 22:40:26 UTC
Permalink
Thanks!

tmux capture-pane -p -S 50 -E -50 -J >! /tmp/temp.txt

Above does the magic! :)


--
Kaushal Modi
Post by Thomas Adam
Post by Kaushal
But to begin with, I am unable to find a way to copy the last few lines
of
Post by Kaushal
the current pane history using a script.
capture-pane
-- Thomas Adam
Loading...