Grep - specific period


 
Thread Tools Search this Thread
Operating Systems HP-UX Grep - specific period
# 1  
Old 02-21-2011
Grep - specific period

Hi everyone,

I want to use grep to search a patern in a folder. But the folder contains millions of files which makes a big delay if I want to search all the files in the folder. I have been trying to use grep to search the last 10 days of all the files. but no success yet! could you advice? thanks in advance.

Messi
# 2  
Old 02-21-2011
you mean you wanna grep the files that have been modified within the last 10 days ?
Please give more clue : name of the folder, name of the files, pattern you are looking for ...

This should give you a list of filenames that are containing the pattern you look for
Code:
find <PATH> -type f -mtime -10 -exec grep -l <pattern> {} +

# 3  
Old 02-28-2011
Basiclly the same as ctsgnb

simple compress - greater than 7 days
Code:
cd /mcdima03/consumer/rms_mf/
 
find ./ -type f -mtime +7 -print | grep -v .Z | xargs -n1 -i compress {} /mcdima03/consumer/rms_mf/datamart/


Last edited by radoulov; 02-28-2011 at 04:28 PM.. Reason: Code tags, please!
Bill L.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep exact match without period or other special characters

If I have a file like the following abc.1 abc abc_1 abc..1 abc*1 abc@1 abc def ghr def...... ddef 5466 def ed def** 123445 I`m trying to find exact words from the list abc def (4 Replies)
Discussion started by: ritakadm
4 Replies

2. Shell Programming and Scripting

Can grep a specific column?

Hello All I have an input file with data below. I would like to grep and display the data where 3rd column contains string or at least one character. Kindly please help me with this! Input: tjfa3|zznpou|224fdd.34.ff3.35 |Tiv|Otj|1 fgduul7|zznikj| ... (7 Replies)
Discussion started by: DoveLu
7 Replies

3. UNIX for Dummies Questions & Answers

Grep a specific process name

Hello, I want to grep a specific process named "TEST" in AIX but not only is it showing what I want but also listing others that have the similar name. How can I only list "TEST"? I've tried using options grep -w with no change and grep -o isn't supported in my environment. Please advise. ... (6 Replies)
Discussion started by: seekryts15
6 Replies

4. Shell Programming and Scripting

Grep on a value in a specific column

I need to grep all records from a file that has 1072 in 3rd column. 1072 can be prefixed by "SBC.", "CLS." or "DPT.". My search is just based on string 1072 in 3rd column. Delimiter in the file is tab. For example: Input FIle: "InvType" "Organization" "SBC.10720101" "CP.BUP.NY" "InvType"... (4 Replies)
Discussion started by: yale_work
4 Replies

5. UNIX for Dummies Questions & Answers

Grep specific lines

Hello I have a file with nearly 90000 lines in x,y,z format but have some lines that I do not need to show. Is there anyway to delete those 3 lines after every 288 lines. Eg I keep the first 288 lines delete (289, 290 291); keep the next 288 lines after those and so on... Thanks (6 Replies)
Discussion started by: Madiouma Ndiaye
6 Replies

6. UNIX for Dummies Questions & Answers

Grep contains specific string

i have file input dsgfdgdfgd> cab |egrep -i '(active|cbu)' 130502-11:34:11 10.133.1.153 9.0j stopfile=/tmp/15959 Trying password from ipdatabase file: /opt/ericsson/amos/moshell/sitefiles/ipdatabase... .. 0 1 CBU1 OFF ON 16HZ ROJ1192209/1 R5E TU8BZ04466... (3 Replies)
Discussion started by: radius
3 Replies

7. Shell Programming and Scripting

grep /target greater than time period??

Hey guys, I'm fairly new at unix shell scripting and I have a quick question. Quick overview I devolped a script where I generate a file ..and I want to grep any time greater than 30 minutes. What i do is runa command to generates the below and puts it into a file: I run ./ggsci << endit... (4 Replies)
Discussion started by: nomiezvr4
4 Replies

8. UNIX Desktop Questions & Answers

polling using sftp process during a specific time period

Hi all, I need to add a process to poll for the files using sftp during the specific time period .How to i add this to the exsiting script. my requirement is to add a process to the below script which has to poll every 5 min from 5 A.M to 12 P.M. How do i do this? ... (1 Reply)
Discussion started by: narasimha123
1 Replies

9. Shell Programming and Scripting

how to grep a specific pattern

Hi I have a file in the following format: ftrn facc ttrd feed xref #1 1365 1366 1367 1097 1098 #2 1368 1369 1370 1095 1096 #3 1371 1372 1373 1065 1066 #4 1374 1375 1376 1099 1100 #5 1377 1378 1379 1080 1081 #6 ... (6 Replies)
Discussion started by: aoussenko
6 Replies

10. UNIX for Dummies Questions & Answers

how to grep from specific field

the file has several date fields.for example, #2, #3,and #5 are date fields. I want grep year '2002' just within #2 field and get all the rows which content year '2002' in the #2 field. is it possible to do this? how to do it? Thanks (2 Replies)
Discussion started by: tiff-matt
2 Replies
Login or Register to Ask a Question