gzcat help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers gzcat help
# 1  
Old 05-29-2012
gzcat help

Hi,

I am using under-noted script and getting the error as under. Please help.

Executing each individual cat / gzcat gives correct answer.
Code:
gzcat /logs/1205[01]* gzcat /logs/12052[0123]* cat /logs/12052[456789] | egrep -v "XYZ|PQR"|wc -l

gzcat: gzcat.gz: No such file or directory
gzcat: cat.gz: No such file or directory

gzcat: /logs/120524.APX: not in gzip format

gzcat: /logs/120525.APX: not in gzip format

gzcat: /logs/120526.APX: not in gzip format

gzcat: /logs/120527.APX: not in gzip format

gzcat: /logs/120528.APX: not in gzip format

gzcat: /logs/120529.APX: not in gzip format  
259

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data

Last edited by vbe; 05-29-2012 at 09:35 AM..
# 2  
Old 05-29-2012
The errors come from the syntax usage which wants the command followed by options if any then [name... ]
so looking at your command line you get:
Code:
gzcat (the command)  [ no options] [name1:/logs/1205[01]*] [name2: gzcat] [name3:/logs/12052[0123]*] [name4:cat] [name5:/logs/12052[456789] ]

You see here that name2 and name4 are the two first "errors"
name5 the list of non gzip format files that you knew werent for you used cat to list if it did work that way...
But it doesnt..., look at the man pages!
This User Gave Thanks to vbe For This Post:
# 3  
Old 05-29-2012
Quote:
Originally Posted by vbe
The errors come from the syntax usage which wants the command followed by options if any then [name... ]
so looking at your command line you get:
Code:
gzcat (the command)  [ no options] [name1:/logs/1205[01]*] [name2: gzcat] [name3:/logs/12052[0123]*] [name4:cat] [name5:/logs/12052[456789] ]

You see here that name2 and name4 are the two first "errors"
name5 the list of non gzip format files that you knew werent for you used cat to list if it did work that way...
But it doesnt..., look at the man pages!
Thanks..any feasible option to execute cat also, as i have both type of files in the directory and processing them seperately will add to double efforts.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

gzcat number of records

Hey guys, I want to do something quite simple but I just can't no matter what I try. I have a large file and i usually just: gzcat test.gz | nohup /test/this-script-does-things-to-the-records.pl -> /testdir/tmp_test.txt But now I need to do it only for the first 100k records. I sure... (7 Replies)
Discussion started by: sg3
7 Replies

2. Shell Programming and Scripting

[Solved] Read a .gz file line by line without using gzcat

Hi all Is there a way to read and process a gzip file line by line similar to a text file without using gzcat.. while processing a text file we will usually use the logic exec<sample.txt while read line do echo $line done Is there a similar way to process the gz file in the same... (4 Replies)
Discussion started by: aikhaman
4 Replies

3. UNIX for Dummies Questions & Answers

How to list file names instead of lines when grep a gzcat command?

Hi, I want to list filenames instead of lines when i search in compresed files for a string. #gzcat *.gz | grep -l 12345 gives me: <stdin> Anyone got a solution on this problem? (2 Replies)
Discussion started by: HugoH
2 Replies

4. Shell Programming and Scripting

gzcat/grep

Hi!!! I am trying to grep a number in more then 1000 files which are .gz. Below is the code :- for i in `ls 20090618yz*_07.znf.gz` do a=`gzcat 20090618yz*_07.znf.gz | grep 9814843011` if then echo $i fi done My objective is to echo the file name also with the data. ... (3 Replies)
Discussion started by: tushar_tus
3 Replies

5. Shell Programming and Scripting

performance issue using gzcat, awk and sort

hi all, I was able to do a script to gather a few files and sort them. here it is: #!/usr/bin/ksh ls *mainFile* |cut -c20-21 | sort > temp set -A line_array i=0 file_name='temp' while read file_line do line_array=${file_line} let i=${i}+1 (5 Replies)
Discussion started by: naoseionome
5 Replies

6. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies

7. UNIX for Dummies Questions & Answers

gzcat (or gunzip -c)

Does anyone know what kind of impact gunzip -c or gzcat has on a system? I am using gunzip -c on files that around 30 Mb compressed and 300Mb uncompressed. How much memory or disk space gets used? Also does anyone know how gunzip -c actually works? The system I am running on is AIX Version 5. ... (1 Reply)
Discussion started by: windjunky
1 Replies
Login or Register to Ask a Question