Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Please help on "if" statement.

$
0
0
Hi,

I want to filter the logs per domain and place it in a single text file, but I'm having a problem with "if" statement because current archiving setup where logs are compressed into two different format ( gzip and compress).

Script:
Code:

domainlist="4prd 5prd 6prd 7prd 8prd"
for domain in $domainlist
  do
          if [ ? ] ; then
                gzgrep "$domain" $dir_arch/logs >> $dir_arch/logs/$domain_$myhost.txt    << for zip files (e.q log.gz)
                gzip -f $dir_arch/logs/$domain_$myhost.txt
  else
                zcat $dir_arch/logs | grep "$domain" >> $dir_arch/logs/$domain_$myhost.txt << for compress files(e.q log.Z)
                gzip -f $dir_arch/logs/$domain_$myhost.txt
          fi
done


please help. thanks!

Regards,
Choco

Viewing all articles
Browse latest Browse all 16232

Trending Articles