Can I speed up my grep command?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can I speed up my grep command?
# 36  
Old 10-10-2013
I've got to watch what I post. I work in a sensitive environment. It even takes awhile for the find from the command line to return like it's processing! When it's done I will paste in here from the screen what I can. Should be able to put everything in but the path.

---------- Post updated at 10:00 AM ---------- Previous update was at 09:58 AM ----------

Ok I am trying those two... Thanks a lot!

---------- Post updated at 10:02 AM ---------- Previous update was at 10:00 AM ----------

First one list every file.And so did the second one! My find command did create an error. It just didn't show me any data! Wow! I'm so lost now!
# 37  
Old 10-10-2013
It's not easy to analyse what you say. So - find -exec ls -la {} \; did succeed; it listed the relevant files. Now try
Code:
find . -name "ONE.xml" -exec ls -la {} \; -exec grep -l "status" {} \;

give it ONE single file name to find. It should ls -la that file and grep that file.
# 38  
Old 10-10-2013
My script is suppose to get the files then copy the xml files but the variable is coming up " " and on the screen from the command line it's just returning with no data for the find combo. But I can see the data & there's the "Status" in all of the ones that I need. Could the output maybe going in some strange place? I look at the time stamp on the files and they say modified at the time that I run my script. No files are moved to the directory.

---------- Post updated at 10:20 AM ---------- Previous update was at 10:16 AM ----------

Screen output:
Code:
D:/home/dv/daa/pt/ae(97) find . -name "*.xml" -exec grep -l "Status" {} \; 2>/dev/null
D:/home/dv/daa/pt/ae(99)

There should be over 13,000 files...

---------- Post updated at 10:22 AM ---------- Previous update was at 10:20 AM ----------

I'm going to try it without the /dev/null/ maybe I can see an error message again...
# 39  
Old 10-10-2013
Sorry, I don't quite get what you are saying. You are always talking generically, no data, no details. How then do you expect somebody to help you?
What variable? What script? What environment? Which files/directories? Come up with real data: OS version, command versions, (partial) directory listing, (relevant) script snippet, (partial) file listings, execution logs, error messages.
# 40  
Old 10-10-2013
You're code worked! How or why did it?
Code:
D:/home/dv/daa/pt/ae(103) find . -name "aac*.xml" -exec ls -la {} \; -exec grep -l "status" {} \;
-rwxrwxrwa   1 SERVER\user.name xyz\Domain+Users    1400 Oct  8 09:33 ./aac-27.xml

# 41  
Old 10-10-2013
It did the ls -la but it didn't do the grep. Sure there is "status" in it? Please post first lines.

You are using "Status" and "status" interchangingly. You know that *nix is case sensitive?
# 42  
Old 10-10-2013
I need the help! Do to the nature of my job there's only information I can disclose. I do truly need the help! I just tried the find command that just worked from the command line and this is what I got.

Code:
D:/home/dv/daa/ae/pt(104) find . -name "*.xml" -exec -exec ls -al {} \; -exec grep -l "Status" {} \;
find: cannot execute "-exec": The system cannot find the file specified.
D:/home/dv/daa/ae/pt(105)

That's what I'm talking about....

---------- Post updated at 10:38 AM ---------- Previous update was at 10:37 AM ----------

The difference is the wild card! Why would that matter?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep command giving different result for different users for same command

Hello, I am running below command as root user #nodetool cfstats tests | grep "Memtable switch count" Memtable switch count: 12 Where as when I try to run same command as another user it gives different result. #su -l zabbix -s /bin/bash -c "nodetool cfstats tests | grep "Memtable switch... (10 Replies)
Discussion started by: Pushpraj
10 Replies

2. Shell Programming and Scripting

Speed : awk command to count the occurrences of fields from one file present in the other file

Hi, file1.txt AAA BBB CCC DDD file2.txt abc|AAA|AAAabcbcs|fnwufnq bca|nwruqf|AAA|fwfwwefwef fmimwe|BBB|fnqwufw|wufbqw wcdbi|CCC|wefnwin|wfwwf DDD|wabvfav|wqef|fwbwqfwfe i need the count of rows of file1.txt present in the file2.txt required output: AAA 2 (10 Replies)
Discussion started by: mdkm
10 Replies

3. Shell Programming and Scripting

Speed Up Grep

Hi, I have to grep string from 20 - 30 files each carries 200 - 300 MB size and append to the file. How to speed the grepping time. cat catalina.out_2012_01_01 | grep "xxxxx" >> backup.txt PLZ, Suggest me, Regards, Nanthagopal A (5 Replies)
Discussion started by: nanthagopal
5 Replies

4. Shell Programming and Scripting

How to speed up grep?

hi i'm greping the files with sepefic keyword, where the file is of too big. Assume there are 10 days log file each of more than 200mb. i've to grep all those files with a specific keywords. for example, 1. i'll grep for error message 2. after the i'll do one more grep for keyword... (4 Replies)
Discussion started by: vij_krr
4 Replies

5. Filesystems, Disks and Memory

data from blktrace: read speed V.S. write speed

I analysed disk performance with blktrace and get some data: read: 8,3 4 2141 2.882115217 3342 Q R 195732187 + 32 8,3 4 2142 2.882116411 3342 G R 195732187 + 32 8,3 4 2144 2.882117647 3342 I R 195732187 + 32 8,3 4 2145 ... (1 Reply)
Discussion started by: W.C.C
1 Replies

6. Shell Programming and Scripting

can anyone help with shell script command about searching word with grep command?

i want to search in the current directory all the files that contain one word for example "hello" i want to achieve it with the grep command but not with the grep * (2 Replies)
Discussion started by: aintour
2 Replies

7. Shell Programming and Scripting

Is there a command to measure compile speed?

Hello Ive written 2 programs in shell and I need to compare their speed (Compile) against one another. what methods could I go about doing this? Is there a feature in shell do accommodate this? (2 Replies)
Discussion started by: Darklight
2 Replies

8. UNIX for Advanced & Expert Users

how to exclude the GREP command from GREP

I am doing "ps -f" to see my process. but I get lines that one of it represents the ps command itself. I want to grep it out using -v flag, but than I get another process that belongs to the GREP itself : I would like to exclude # ps -f UID PID PPID C STIME TTY TIME CMD... (2 Replies)
Discussion started by: yamsin789
2 Replies

9. Filesystems, Disks and Memory

dmidecode, RAM speed = "Current Speed: Unknown"

Hello, I have a Supermicro server with a P4SCI mother board running Debian Sarge 3.1. This is the "dmidecode" output related to RAM info: RAM speed information is incomplete.. "Current Speed: Unknown", is there anyway/soft to get the speed of installed RAM modules? thanks!! Regards :)... (0 Replies)
Discussion started by: Santi
0 Replies

10. UNIX for Dummies Questions & Answers

grep - speed of search

I grepped for a string from a directory of very large files. This took quite a long time (not a problem). When I grepped for a different string from the same files immediately after, the output was MUCH quicker. My question is, does anybody know why the second grep was so much quicker than the... (1 Reply)
Discussion started by: davirime
1 Replies
Login or Register to Ask a Question