The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to find files older than 2 hours pt14 AIX 3 03-05-2008 12:31 PM
how to find files older than 4hours in HP-UX caprikar UNIX for Advanced & Expert Users 3 11-27-2007 05:23 PM
find files older than a given file Shivdatta Shell Programming and Scripting 5 07-24-2006 07:25 AM
only find files older than x minutes old dsimpg1 Shell Programming and Scripting 1 05-18-2006 11:48 PM
Find files older than 20 days & not use find halo98 Shell Programming and Scripting 2 05-18-2006 02:19 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 2 Weeks Ago
Ikon's Avatar
Ikon Ikon is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2008
Location: Phoenix, Arizona
Posts: 669
find files older than and containing upper and lower case text then tar.

I'm tring to:

find files recursively older than x days that contain dat or DAT then tar them

I can find the files older than 90 days containing dat with this:

find . -mtime +90 -type f -name "*dat*" -exec tar -cvvfp /some/path/some.tar {} \;


but how do I do it case insensitive?

find . -mtime +90 -type f -name "*dat*" and "*DAT*" -exec tar -cvvfp /some/path/some.tar {} \;


EDIT: Im using HP-UX so there is no "-iname" for the find command.

---------- Post updated at 11:05 AM ---------- Previous update was at 10:19 AM ----------

I found that this would not work anyway.. It creates a new tar file everytime it finds a file.

But I did figure out how to do it.

tar cvvfp /path/to/some.tar `find . -mtime +90 -type f | grep -i "dat"`

Last edited by Ikon; 2 Weeks Ago at 01:42 PM..
  #2 (permalink)  
Old 2 Weeks Ago
Dicloflex Dicloflex is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 4
Sorry this is not much help. I always thought you could do something like:

find . \(-name '*.txt' -o -name '*.TXT'\) -print

But I've just tried it on my HP-UX and it gives:

find: bad option -o

man find
suggests -o is valid, though

expression -o expression Logical OR operator. True if either or
both of the expressions are true.


Good luck in finding your answer.
  #3 (permalink)  
Old 2 Weeks Ago
mkastin mkastin is online now
Registered User
  
 

Join Date: Jun 2009
Posts: 32
Try this:

Code:
find /* -mtime +90 -type f -name "*dat*" -or -name "*DAT*" - exec tar -cvvfp /some/path/some.tar {} \;
Works for me on RH

Last edited by mkastin; 2 Weeks Ago at 02:32 PM..
  #4 (permalink)  
Old 2 Weeks Ago
Dicloflex Dicloflex is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 4
Seen my error! you can use this form of construct for your or clause if you wish. Have tested on HP-UX and it throws up my .txt and .TXT files

find . \( -name \*.txt -o -name \*.TXT \) -print
./env.txt
./dir.txt
./shella.txt
./taila.txt
./tailb.TXT
./number.txt
./finished.txt
./dir2.txt
./shellb.txt
./cutshellb.txt
./tailb.txt
./numberb.txt
./result_c.txt

Regards
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0