clustershell
clustershell copied to clipboard
RFE: `nodegrep`, a wrapper or tool to make `grep node-[1,4,7-8],@ngrp /var/log/messages` do the right thing.
I find myself grepping for node names often and building "(node1|node2|thisnode|thatnode)" style expressions often, just occurred to me today that many times these will collapse into a noderange or in some cases I what I really want to do isnodegrep sp@batch ... for some predefined group in my clustershell config. Haven't moved the thought process far enough along to decide how hard this would be to do or how to do it yet, just throwing it out as an idea.
Or if there is already a way to do this, appreciate a pointer to how.
You can make a small script or even a shell function that does that for you:
nodegrep() {
local SET="$1"
shift
grep -F "$(nodeset -S'\n' -e "$SET")" "$@"
}
Brilliant, thank you @martinetd !
(might want to add -w to the grep, in case you don't pad node numbers, to avoid e.g. example1 from matching example102 or whatever)