Shell Script for grepping [message #98861] |
Sat, 17 May 2003 15:07 |
Ced
Messages: 1 Registered: May 2003
|
Junior Member |
|
|
I just started learning to write shell scripts a couple of days ago and I'm trying to work a glitch out of a script I've been using to find a string, sort it a particular way, and then save it to a text file. the script looks like this:
#!/bin/sh
Grep -in "whatever" filename.tex | sort -bdf | tee greppedtext.txt
This script works fine as long as I name the specific file to be grepped within the script. However, I want to make the file I'm grepping a *variable* so I can determine what it will be from the command line like this:
$ubergrep "whatever" anyfile_in_directory.tex
How do I make the file to be grepped a variable in the script? I've looked all over my "Unix Power Tools" and the web for solutions. I would be very appreciative of anyone who could help me with this problem. Thank you!
|
|
|
|