Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: nodegrep, a wrapper or tool to make grep node-[1,4,7-8],@ngrp /var/log/messages do the right thing. #450

Open
griznog opened this issue Sep 16, 2020 · 3 comments

Comments

@griznog
Copy link
Contributor

griznog commented Sep 16, 2020

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.

@martinetd
Copy link
Collaborator

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")" "$@"
}

@griznog
Copy link
Contributor Author

griznog commented Sep 16, 2020

Brilliant, thank you @martinetd !

@martinetd
Copy link
Collaborator

(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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants