Timeline for List all regular files containing (in their name, directory or their content) a specific (sub)string
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 12, 2015 at 17:53 | vote | accept | dziadek1990 | ||
| Apr 12, 2015 at 17:43 | answer | added | rahul | timeline score: 2 | |
| Apr 12, 2015 at 17:39 | comment | added | dziadek1990 |
@rahul I'm okay with using find and grep seperately. The requirement was ambiguous enough and didn't specifically say I have to do it in one command.
|
|
| Apr 12, 2015 at 17:26 | comment | added | rahul |
I'm still a bit confused as to the requirement. Since you mentioned name, directory, or content . What if only the filename matches, what do you want to print then? Does the requirement have to be covered in the same command? Would you mind using find for the file/directory and grep for the content?
|
|
| Apr 12, 2015 at 17:11 | comment | added | dziadek1990 | @rahul Expected output: names of regular files in a given directory (and its subdirectories) which (either in name, directory, or content) have a (sub)string "filesystem", and if they are regular text files, then print the number of the line in them in which said (sub)string occurs. The code I posted was what I had, but you said it was wrong so I guess I'll have to re-do it from a scratch. | |
| Apr 12, 2015 at 17:01 | comment | added | rahul |
You don't have to do find and grep. You can pass the parameter to find. find /sys -name "*filesystem*" . Also find searches the filenames. Do you also want to search for content? You should use grep for that. Maybe if you posted your code and the details of your expected output, it would help
|
|
| Apr 12, 2015 at 16:46 | history | asked | dziadek1990 | CC BY-SA 3.0 |