Missing conjunction


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Missing conjunction
# 8  
Old 12-20-2010
Quote:
between 7 and 14 days
Quote:
find . -name "*.bin" -type f -mtime +$file_arch_st_time -mtime -$file_arch_end_time

It may be that this boolean version will produce the desired range. The specification is still ambiguous but I think that we are homing in on the solution!
The problem with the original "find" parameters is that the second "-mtime" takes precedent over the first "-mtime".

Code:
find . -name "*.bin" -type f \( -mtime +$file_arch_st_time -a -mtime -$file_arch_end_time \)

# 9  
Old 12-20-2010
Code:
gtar cvzf SessLogs`date +%Y%m%d`.tar SessLogs`date +%Y%m%d`

I guess you need to do this. This will move content of SessLogs`date +%Y%m%d` into SessLogs`date +%Y%m%d`.tar
This User Gave Thanks to anurag.singh For This Post:
# 10  
Old 12-20-2010
You either use something like:
Code:
find . -print | cpio -ov | compress > backupfile

or you use:
Code:
tar cvzf backupfile file1 file2 file3 ...

so you would have something like:
Code:
find . -print > tempfile
tar cvzf backupfile.tgz `cat tempfile`
or
tar cvzf backupfile.tgz --file=tempfile

You can't mix the methods up.

You need to test these individual lines of your script one at a time.

Last edited by KevinGB; 12-20-2010 at 06:33 PM..
# 11  
Old 12-20-2010
@Kevin,

Great thanks. It now creates the file. I used the command like this.

Code:
find . -name "*.bin" -type f -mtime +7 -mtime -60 | cpio -ov | compress -v > SessLogs`date +%Y%m%d`.Z

It creates a file called SessLogs20101220.Z.

I uncompress this file using the command

Code:
uncompress -f SessLogs20101220.Z

it uncompresses the file and creates an uncompressed file
[CODE]SessLogs20101220[CODE]

Now how to extract contents from the uncompressed file?

-Sam

---------- Post updated at 05:59 PM ---------- Previous update was at 05:56 PM ----------

Thanks Kevin.

I used the following command as you suggested.

Code:
find . -name "*.bin" -type f -mtime +7 -mtime -60 | cpio -ov | compress -v > SessLogs`date +%Y%m%d`.Z

Now it creates a file called

Code:
SessLogs20101220.Z

I uncompress the above file using

Code:
uncompress -f SessLogs20101220.Z

It creates a uncompressed file
Code:
SessLogs20101220

Now how to extract the contents from an uncompressed file?

Thanks much

Sam
# 12  
Old 12-20-2010
Note I still think you need to use -print with cpio.

You would be better not to uncompress your file in case you hit the 2GB file size limit.

To list what is in the file use:
Code:
zcat SessLogs20101220.Z | cpio -itv

To extract it I would use something like:
Code:
zcat SessLogs20101220.Z | cpio -iduv

Please check the man page for cpio to see what the best options for you are.

If zcat isn't on your system try gzcat.

Last edited by KevinGB; 12-20-2010 at 07:34 PM..
This User Gave Thanks to KevinGB For This Post:
# 13  
Old 12-20-2010
Quote:
find . -name "*.bin" -type f -mtime +7 -mtime -60 | cpio -ov | compress -v > SessLogs`date +%Y%m%d`.Z
You cannot have two "-mtime" parameters on the same "find" command line without using brackets. It will not give you a syntax error but it will not work.
This User Gave Thanks to methyl For This Post:
# 14  
Old 12-21-2010
Thanks Kevin, Methyl and Anurag Singh. Let me try the options suggested by you.

Thanks much.

Sam

---------- Post updated at 11:35 AM ---------- Previous update was at 10:31 AM ----------

Quote:
Originally Posted by methyl
It may be that this boolean version will produce the desired range. The specification is still ambiguous but I think that we are homing in on the solution!
The problem with the original "find" parameters is that the second "-mtime" takes precedent over the first "-mtime".

Code:
find . -name "*.bin" -type f \( -mtime +$file_arch_st_time -a -mtime -$file_arch_end_time \)


Methyl -- Can you pl explain the above statement in detail?


Also I have changed the find command per your suggestions.

Code:
find . -name "*.bin" -type f \( -mtime +$file_arch_st_time -a -mtime -$file_arch_end_time \) | cpio -ov | compress -v > SessLogs`date +%Y%m%d`.Z

But it gives the following error:

Code:
w_test.bin not archived: uid greater than 65535.
1 blocks

It creates the compressed file with 0 bytes


Regards
Sam

Last edited by svajhala; 12-21-2010 at 12:51 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

Yum - resolving missing dependencies that are not missing

I am trying to install VirtualBox on RHEL 5 but I need the 32 bit version for 32 bit Windows. When I run yum I get the following: sudo yum localinstall /auto/spvtg-it/spvss-migration/Software/VirtualBox-4.3-4.3.2_90405_el6-1.i686.rpm Loaded plugins: fastestmirror Setting up Local Package... (13 Replies)
Discussion started by: gw1500se
13 Replies

2. SuSE

How to resolve missing missing dependencies with opensuse 11.3 and 12.3?

Hello, This is a programming question as well as a suse question, so let me know if you think I should post this in programming. I have an application that I compiled under opensuse 12.2 using g77-3.3/g++3.3. The program compiles and runs just fine. I gave the application to a colleague who... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

3. UNIX for Dummies Questions & Answers

Nohup in conjunction with time

hi, if I exectute "nohup time ls -1" I get the following output $ nohup time ls -1 file_1 file_2 file_3 file_4 file_5 0.000u 0.001s 0:00.00 0.0% 0+0k 0+0io 0pf+0w This is all OK. But if I want to capture this whole output in to a text file I would want to use something like ... (1 Reply)
Discussion started by: BearCheese
1 Replies

4. Shell Programming and Scripting

[: missing `]'

Hi, I am getting this error while running the following code. i=`awk '{print $2}' test1.txt` j=`awk '{print $4}' test1.txt` k=`awk '{print $6}' test1.txt` if ; then echo "Up." else echo "down" fi rm -f test.txt test1.txt error is this: line 12: ' Please suggest. (2 Replies)
Discussion started by: arijitsaha
2 Replies

5. Shell Programming and Scripting

Problem with date in conjunction with cut?

I got rather bored so i decided to create a script that creates a countdown, and shows hours:minutes:seconds till that time. It works fine until the seconds of the actual time reaches 8, then it tries to use it to work out the difference as in "SECONDDIFF=$" Here's my code where I get the... (12 Replies)
Discussion started by: DuskFall
12 Replies

6. Shell Programming and Scripting

How to go about Using a "Validate an IP script" in conjunction with Logfile?

Hi, so I have been trying to write a shell script to go through a log file and through that, generate another file with all the Valid IP addresses it finds. So there's the complication that there could be incomplete or invalid data which would disqualify it from making my "Valid IPs" file I need... (3 Replies)
Discussion started by: shellcow
3 Replies

7. Shell Programming and Scripting

conjunction two files

I need to your help. I want write a script search for rows in file1 if exist in file2 it will print rows from file2 else it will print rows from file1 with out any duplicate ... (4 Replies)
Discussion started by: kmuqalled
4 Replies

8. UNIX for Dummies Questions & Answers

Missing Package

Hi All, I have a server running SunOS 5.9, on this I need to install Oracle 10g; however the installer returns ERROR: Unable to convert from "UTF-8" to "646" for NLS! Did some digging around and found that I need the SUNWuiu8 package. However I'm not sure where I can download the... (1 Reply)
Discussion started by: Zak
1 Replies

9. Shell Programming and Scripting

what am I missing?

I have the following portion of a script Check() { echo "\n\nChecking that all constraints are Enabled" echo "..." sleep 2 CHECK_COUNT='sqlplus -s $1 <<-EOSQL4 set feed off pause off pages 0 head off; set linesize 150 echo off; select count(*) from user_constraints where... (4 Replies)
Discussion started by: Zelp
4 Replies
Login or Register to Ask a Question