help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] History Expansion (J.B.)


From: J.B.
Subject: Re: [Help-bash] History Expansion (J.B.)
Date: Mon, 15 Feb 2016 18:08:24 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 01/30/2016 09:00 AM, address@hidden wrote:

I'm not too clever with history. I find that I don't use it that much, if
I did I'd be using zsh, not bash (they have a much more evolved history
setup).
Also, your command will not exit until you terminate it manually, that's
what tailf and tail do, so I'm confused as to why your expecting to read
multiple file in since your command entails that you intend to monitor
the one log file for sometime.
That being said, if your just looking to play with the history rreally
quick try UppArrow, Ctrl-w, (edit the part you want), Ctrl-y (to add the
stuff you killed).
If you want to get one line from each file and wait for more whilst
grep'ing those lines you could do.
tailf -n1 /some/really/long/path/to/a/logfile \
/some/other/really/long/path /and/now/a/third/path \
| grep -iw "some\|neat\|things\|to\|grep"

Hi David.

Currently this is what I'd do after terminating the tailf command:
1. Ctrl-P
2. Ctrl-A
3. Alt-F several times until I got the the end of the long file name
4. Ctrl-W to delete the file's absolute name
(or Alt-D several times from the beginning of the filename)
5. type out the new path to the next file I want to tailf

What I'd like to do instead is use history commands to quickly replace the long 
file path/name with a different one.

What I've more recently tended to do is Ctrl-P, Ctrl-X Ctrl-E (or `fc -e vim' if $EDITOR 
is set to emacs or nano) and edit the command line using vim's efficient editing 
commands. But I'd really just like a way to tell bash, "replace that long string 
that matches '!?really/lon?:%' with 'some/other/file'." (plus, vim's filename 
completion is way too slow (^X^F)).

But the closest I can get is `!:s/"type the entire file name"/"type the new file 
name"', which is a real drag.

Something else that is a bit more useful is to specify the file name first 
(with a redirect), which shortens the distance the cursor has to move:
< path/to/file tailf -n 1 [etc ....]

But that assumes I don't just mindlessly bang away at the keyboard, which is a 
bad assumption. (I'd be in so much trouble if bash didn't accept flags/options 
scattered throughout the command line).
ls /path/to/a/file -Fd /and/another/file/here -lt




reply via email to

[Prev in Thread] Current Thread [Next in Thread]