Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help reading a file

Status
Not open for further replies.

yaway

IS-IT--Management
Aug 7, 2003
12
US
I have a file with two lines for data and I need to search the file for only one word. If I find the work I need to run a script (Which I have already) if not I need the program to do nothing.

The word I am looking for is ONLINE.

Thank You
Yaway
 
A better place to would be 'UNIX Scripting' forum, but....
Your milage may vary with the definition of a 'word'

#!/bin/ksh
[ $(grep 'ONLINE' myFile.txt ] && echo "found ONLINE";

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
ooops - sorry.

[ $(grep -c ONLINE myFile.txt) -gt 0 ] && echo 'found ONLINE'

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top