SUMMARY: SED or AKW statement

From: <>
Date: Mon Feb 18 2002 - 16:29:54 EST
The original question:

I was looking for some help in creating a SED or AWK statement to pull one
line of information into a script and use it in a grep statement.


Within a shell script

"pull one line of information into a script and use in a grep statement."

Filename with Variable : variable.txt
     The first line of the file variable.txt contains


Grep "Variable"  /opt/Anydatafile.txt

I would appreciate any help.

The solution:
Tom Payerle reminded me that the grep -f option is sufficient for this.

Thanks also to the following:
Ian MacPhedran
David Ledger
Tom Payerle
Elizabeth Lee
Sanjiv K. Bhatia
Rainer Heilke
Don Mies
Edward Scown
Slamet Ahmad Fadilah
Martin Smitt
Karl Vogel
David Glass
Davorin Bengez
Fabrice Guerini
Dave Mitchell

Some additional suggestions:

head -1 $(grep -l $VARIABLE *)

Grep "Variable"  /opt/Anydatafile.txt

grep "`head -1 variable.txt`" /opt/Anydatafile.txt

VAR1=`head -9 file.txt | tail -1`
grep $VAR1 file2.txt
sunmanagers mailing list
Received on Mon Feb 18 15:29:19 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:34 EST