Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix: Grep on console output

Tags:

grep

unix

console

This is my first question on stackoverflow! I want to have a unix script that will run grep on the console output. Here is what my script does: 1. Telnet into a remote server (I have done this part successfully) 2. On successful login, the remote server displays outputs information on the console. I need to run grep on that console output (need help with this)

So, I need a script to run grep on the output appearing on the console.

Any thoughts??

Thanks, Puneet

like image 986
Puneet Sohi PMP CCNP Avatar asked Feb 24 '23 05:02

Puneet Sohi PMP CCNP


1 Answers

Use SSH instead. It's more secure and far easier to script.

ssh remoteusername@remotehost:/path/to/remote/script | grep 'something'

with appropriate key setup, it won't even prompt you for a password.

like image 127
Marc B Avatar answered Mar 04 '23 13:03

Marc B