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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My script in a pipe??? 1

Status
Not open for further replies.

rogsal

Programmer
May 12, 2004
10
0
0
SE
Hi all!

I've written a script that greps for a string and outputs b lines before and a lines after.
> fblock STRING -b 2 -a 2 FILE

but now I would like to use it in a pipe like this:
> unzip -c enormous_log.gz | fblock STRING -b 2 -y a

How do I do that???
 
I don't know fblok, perhaps man fblock ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Oh! Maybe I was a bit confusing in my first post.
fblock is the name of my script which I want to modify so it can be used in a pipe aswell.
 
Can you please post this script to help us helping you ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
The script would need to check if the input file is supplied as an argument. If it is not, then assume that input is piped. The first command in the script that uses stdin must then process the pipe, e.g...
[tt]
if [[ ! $File ]]
then
File=/tmp/file$$
cat > $File #---this is being piped into
fi[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top