I want to create a script wherein I can grep a particular word from a specific path of remote server and display that whole grep sentence in the output.
Currently, I have to take access to the target server, then to go in the particular path and then use the grep command.
#!/usr/bin/ksh
clientID="00000"
print -n "\nEnter the ID (Enter ybr for ybr_ybrfndt): $1"
read clientID
print "$clientID"
for HOST in $(cat qa_servers.txt ) ;
do
ssh $HOST "uname -a"
cd /apps/WebSphere/NA70_TBA/config/cells/CellV70_TBA
grep $clientID resources.xml;
done
for server in "${qa_servers.txt[@]}"; { ssh cacher@$server
cd /apps/WebSphere/NA70_TBA/config/cells/CellV70_TBA untar archive
clientID="00000"
print -n "\nEnter the client ID: $1" read clientID print "$clientID"
grep '$clientID' resources.xml }
– user334028 Jan 29 '19 at 09:57for
loop does not have ado
and you are using variables (some of which are arrays) that you never set. – Kusalananda Jan 29 '19 at 10:21clientID="00000"
print -n "\nEnter the ID (Enter ybr for ybr_ybrfndt): $1" read clientID print "$clientID"
for HOST in $(cat qa_servers.txt ) ; do ssh $HOST "uname -a" cd /apps/WebSphere/NA70_TBA/config/cells/CellV70_TBA grep $clientID resources.xml; done
– user334028 Jan 29 '19 at 10:41