help-bash
[Top][All Lists]
Advanced

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

[Help-bash] History Expansion


From: J.B.
Subject: [Help-bash] History Expansion
Date: Thu, 7 Jan 2016 16:58:00 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0

Hi folks. Trying to sort out how to use word substitution on history events in this one specific case-

Say I have this long command:
tailf -n 1 /some/really/long/path/to/a/logfile | grep -iw "some\|neat\|things\|to\|grep" And now i want to run that command on a different log file, but this doesn't seem to work:
!?/som?:%:s,,/path/to/new/logfile
It instead only matches '/som' and performs the substitution on that pattern alone.

This does work:
!tai:-2 /path/to/new/logfile !tai:4*
But that sucks.

This also works:
!?/som?:s,/some/really/long/path/to/a/logfile,/path/to/new/logfile
But sucks even more.

I want a way to match an argument and perform a substitution on it without having to type it out entirely. Using the star glob as the string to match doesn't work: :%:s,*,/path/to/new/logfile. How can I accomplish that?



reply via email to

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