FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

preparation:fhhome:fhghost.html



This is an old revision of the document!


fhghost.sh

#!/bin/bash
#===========================================================
# FastHandle Grep Host
#
# fhgh.sh  "*"  hosts_xxxx     like grep PATTERN FILE
# fhgh.sh  PATTERN FILE        like grep PATTERN FILE
#
#===========================================================

PATTERN="$1"
FILE="$2"

grep -Ev "^#|^$"  "${FILE}"  | grep -E "${PATTERN}"  &> /dev/null
if [ $? -ne 0 ] ; then
    echo ""
    echo "ERROR"
    echo "How to use"
    echo "fhgh.sh  PATTERN FILE "
    exit 1
fi

grep -Ev "^#|^$" "${FILE}"  | grep -E "${PATTERN}" | awk {'print $1'}
exit 0



preparation/fhhome/fhghost.html.1510503011.txt.gz ยท Last modified: 2017/11/13 01:10 by kurihara