Re:Sed – An Introduction and Tutorial
by scarecrowbob on Wednesday January 07, 2015 @10:01PM
(#8854812)
here's an example of the first useful grep I learned :
history | grep "git push"
Re:Sed – An Introduction and Tutorial
by JetSpiegel on Thursday January 08, 2015 @05:17AM
(#8855776)
Just use Ctrl-R in bash to search backwards in the history
Re:Sed – An Introduction and Tutorial
by scarecrowbob on Thursday January 08, 2015 @09:48AM
(#8856563)
I didn't know you could do that, so it's good to have an option- thanks.
But how do you then pipe that to tail? :D
Re:Sed – An Introduction and Tutorial
by JetSpiegel on Thursday January 08, 2015 @11:58AM
(#8857277)
You don't, it's a readline thing, it doesn't really generate a file you can manipulate. (I expect to be proven wrong with some insane one-liner though).
What you can do is press Ctrl-R again and it will search the older match. There's also forward match but I can't recall the shortcut.
Re:Sed – An Introduction and Tutorial
by jpwgarrison on Wednesday January 07, 2015 @11:42PM
(#8855033)
I alias "history | grep" to "hrep" and I'd bet it is one of my top 3-5 commands.
Why not find out:
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | headuniq seems a bit easier to understand here:
history | awk '{print $2}' | sort | uniq -c | sort -rn
Re:Sed – An Introduction and Tutorial
by scarecrowbob on Thursday January 08, 2015 @01:08AM
(#8855204)
:D HA! Nice!
2936 git 1166 cd 409 ll 343 ssh 302 l 279 vagrant 223 ls 201 la 151 cat 140 mkdir
Why not use C-r?
This could change your life:
https://github.com/junegunn/fzf
It's a fuzzy searcher for Ctrl-r that shows all possible results, updating as you type.
Re:Sed – An Introduction and Tutorial
by jpwgarrison on Thursday January 08, 2015 @12:25PM
(#8857474)
Sometimes that is what I want, but usually I want a list of all the iterations of something to cut/paste/adjust.
# search current and all child directories for files containing "bananas", case insensitive $ grep -ir "bananas" .