LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2012, 09:04 AM   #1
laks
Member
 
Registered: Feb 2012
Posts: 34

Rep: Reputation: Disabled
Gzip list of logfiles


Hello,

I have a list of logfiles, whose names start with a common name and appended by .1, .2 etc(created by log4j). Now I want to retrieve these files from a shell script and run gzip for these files. Here is the code that I wrote, but it is not working.

PACKAGERLOGDIR is location of logfile
PACKAGER_LOGFILE is a file containing the String that these logfile names start with.

My Program is

find $PACKAGERLOGDIR -name ` cat $PACKAGER_LOGFILE` > $filelist

for file in `cat $filelist`; do

gzip $file

done.

This is not working. Could any help me find out where I am going wrong.

Thanks,
Lakshmi
 
Old 05-09-2012, 09:17 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Take it one command at a time...

first, does your find statement produce the desired result? (Re-directing to a filename starting with "$" does not look right to me.)
 
Old 05-09-2012, 08:47 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Wouldn't it be better just to use the logrotate tool to handle that automatically?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open gzip file? I have gzip installed mhg Linux - Newbie 3 10-24-2008 03:18 AM
[gzip] appears in process table after gzip command completes redmanDBA Linux - General 0 02-26-2008 07:12 AM
apt-get update error: "gzip: stdin: not in gzip format" haertig Debian 0 08-02-2006 06:21 PM
Solaris 8 gzip issues- cannot gzip -d lynx sixosix Solaris / OpenSolaris 4 03-13-2005 04:17 PM
Logfiles wonderpun Linux - General 3 09-01-2002 04:27 AM


All times are GMT -5. The time now is 03:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration