SUMMARY: SED or AKW statement

From: <Robert.Barkhymer_at_rcn.net>
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.

example:

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
hello

#!bin/sh

Grep "Variable"  /opt/Anydatafile.txt
               hello

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:

#!/bin/ksh
head -1 $(grep -l $VARIABLE *)


Grep "Variable"  /opt/Anydatafile.txt
               hello

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


#!/bin/sh
VAR1=`head -9 file.txt | tail -1`
grep $VAR1 file2.txt
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
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