LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 08: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, 08:17 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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, 07:47 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

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


Reply



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 02:18 AM
[gzip] appears in process table after gzip command completes redmanDBA Linux - General 0 02-26-2008 06:12 AM
apt-get update error: "gzip: stdin: not in gzip format" haertig Debian 0 08-02-2006 05:21 PM
Solaris 8 gzip issues- cannot gzip -d lynx sixosix Solaris / OpenSolaris 4 03-13-2005 03:17 PM
Logfiles wonderpun Linux - General 3 09-01-2002 03:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:24 AM.

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
Open Source Consulting | Domain Registration