Timeline for How to get list of files with not having search string
Current License: CC BY-SA 3.0
15 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 14, 2015 at 4:27 | comment | added | kumar2008 | ok let me explain what I am looking. I have a script which transmits files. For each run I am creating a log file which basically has the entry giving how many files transmitted in that run. There will be "CountOfFilesTransmitted=0" entry in all the logs. If there are any files transmitted I will increment this counter and end of the log will reflect that number. example: "CountOfFilesTransmitted=10". Find command should only give those log files in which CountOfFilesTransmitted is greater than 0. Hope I am clear. Thanks! | |
| Oct 7, 2015 at 0:34 | comment | added | kumar2008 | In the solution you gave. if I give "find . -type f | xargs grep -le "CountOfFilesTransmitted=[1-100]" It is also pulling CountOfFilesTransmitted=0 Which apparently in all the files. And displaying all files basically. | |
| Oct 6, 2015 at 14:03 | comment | added | Gravy |
@kumar2008 I'm a bit confused now. If all files contain a starting point of 0 in them, then A) What results are you actually looking for? and B) What is not working about the solution I wrote out above? Any more explanation would help.
|
|
| Oct 6, 2015 at 0:24 | comment | added | kumar2008 | Gravy, yes there are multiple lines. In every file there will be CountOfFilesTransmitted=0 for sure initially as it initializes. As transmission is done. there is another entry. for example. If it transmits 3 files then CountOfFilesTransmitted=3. if it transmits 100 files then CountOfFilesTransmitted=100. Hope I am clear this time. | |
| Oct 5, 2015 at 21:41 | comment | added | Gravy |
@kumar2008 Are those files that contain CountOfFilesTransmitted=0 AND CountOfFilesTransmitted=<someother number> that is something i haven't been sure on your question, are there multiple lines that have countoffiles, and you want files that don't contain 0 at all?
|
|
| Oct 5, 2015 at 21:39 | comment | added | kumar2008 | Hi Gravy, sorry for late reply. had a rough day. I have tested and above command also brings files which has CountOfFilesTransmitted=0 when given [1-1000] | |
| Oct 2, 2015 at 14:21 | comment | added | Gravy | @kumar2008 let me know if that doesn't work for you and i'll work on another answer :) Assuming there isn't a correct answer in the other question | |
| Oct 2, 2015 at 14:12 | comment | added | Gravy |
@kumar2008 The only question would be if a file might have both 0 and another one. This answer will find 100, 101, 1000, 10000. Essentially, matching that the first digit after CountOfFilesTransmitted is not 0, So it will find anything that isn't just 0, on the other hand it will not find 01 if you have that formatting it will fail.
|
|
| Oct 1, 2015 at 23:54 | comment | added | kumar2008 | Hi Gravy, Appreciate your reply! But there are few files with 100, 101 as well. If I use [1-1000]. It also finds 0 right? | |
| Oct 1, 2015 at 22:15 | history | edited | Gravy | CC BY-SA 3.0 |
added 170 characters in body
|
| Oct 1, 2015 at 22:14 | comment | added | Gravy | @don_crissti Hmm... Very valid, Hadn't considered that as a possible outcome.. And yes, Just Did a test of the other question's answer, Definitely meets OP's needs.... Assuming of course his needs are as I understand them. | |
| Oct 1, 2015 at 22:08 | history | edited | Gravy | CC BY-SA 3.0 |
Removed some unneeded fluff
|
| Oct 1, 2015 at 22:00 | history | edited | Gravy | CC BY-SA 3.0 |
updated answer
|
| Oct 1, 2015 at 21:54 | history | edited | Gravy | CC BY-SA 3.0 |
added 148 characters in body
|
| Oct 1, 2015 at 21:38 | history | answered | Gravy | CC BY-SA 3.0 |