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

simple pipe question

Status
Not open for further replies.

ggggus

Programmer
Jul 5, 2003
114
I'm a relative newbie trying to understand the pipe.

I've got a gzip'ed log file that I want to run a couple of commands on...sure I could run them all seperately, but I'm trying to run them from a php application...and more importantly, I'm trying to learn new stuff here....so here's what I've got.

gzip -d php_error_log.1.gz | tac > temp.log

But that doesn't work...it unzips the log file and creates a blank temp.log file. Can someone tell me how to do what I'm trying to do in one line?

***************************************
J. Jacobs
 
I figured it out...the problem wasn't my use of the pipe... I needed a -c on the gzip command.

***************************************
J. Jacobs
 
hi,
not all programs are "pipeable", it depends how they are written, and how are managed stdin,out,err.
The more program or sort are pipeable.
Pipe is a "automation" tool: does in a just 1 (apparent) command what you can do in different steps: he creates temporary files (in var dir) and at the end of single command, thos fole are deleted. However in our
jobs, you have a system (a command, a computer, or other)
that does not go, you must have the ability to segment
the system and invividuate which is the sector that is responsible of malfunctioning.

Then try 1st

1) gzip -c -d php_error_log.1.gz > php_error_log.1
2) tac php_error_log.1 > error.log
or
tac php_error_log.1 | more
ecc

Using this approach you'll find becouse you have to use -c option as suggested by yourself

to reach
gzip -c -d php_error_log.1.gz | tac > temp.log
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top