Scroll to navigation

hostgrep(1) General Commands Manual hostgrep(1)

NAME

hostgrep - print lines matching hostlist

SYNOPSIS

hostgrep [OPTION]... HOSTLIST [FILE]...

DESCRIPTION

Search the files for lines matching the given hostlist. If no files are given, search the standard input.

For each line, the program tries to find all hostnames and hostlists. Hostlists are then expanded to hostnames. The set of hostnames in a line is then compared to the set of hostnames given by the HOSTLIST on the command line. By default, the line is printed if any hostname from the HOSTLIST is found in the line.

OPTIONS

Print a line if all hostnames in the given HOSTLIST is found in the line.
Print a line if any hostname in the given HOSTLIST is found in the line (the default).
Do not show the filename in front of matching line. This is the default if at most one FILE is given.
Show the filename in front of matching lines. This is the default if two or more FILES are given.
Invert the sense of matching, to select non-matching lines.
Show line number before match.
Restrict host matching to the part of the line that is matched as group 1 by this regexp.

EXAMPLES

hostgrep n[100-102] /var/log/slurm/accounting/2009-02-22
hostgrep -h --all n[100-102] /var/log/slurm/accounting/*
hostgrep --restrict='^([^:]*):' n[1-8]

BUGS

The program has a rather naive notion of what constitutes hostnames and hostlist.

For version 1.21 and earlier, hostnames were allowed to contain exactly upper and lower case A-Z and the digits 0-9. This meant that you could not grep for names like "rack02-pos13". From version 1.22, the code dynamically adds additional characters from the hostlist provided on the command line, so that it will work to grep for hostnames containing those characters.

AUTHOR

Written by Kent Engström <kent@nsc.liu.se>.

The program is published at http://www.nsc.liu.se/~kent/python-hostlist/

SEE ALSO

hostlist (1)

The hostlist expression syntax is used by several programs developed at LLNL (https://computing.llnl.gov/linux/), for example SLURM (https://computing.llnl.gov/linux/slurm/) and Pdsh (https://computing.llnl.gov/linux/pdsh.html).

See the HOSTLIST EXPRESSIONS section of the pdsh(1) manual page for a short introduction to the hostlist syntax.

Version 2.2.1