https://cmdchallenge.com/#/search_for_files_containing_string
No u
>>61995989
># Print all files in the current directory,
># one per line (not the path, just the filename)
># that contain the string "500".
what did he mean by this?
>>61996573
ls -1 *500*
grep -F '500' -l ./*
if you can't RTFM, you are lost
i don't understand why i can'trm -rf .for the delete_files one.
>command timed out
seriously?
>>61997034grep -Fl 500 *
Wow, anon, you're wasting keystrokes for nothing.
>>61996878
Files that *contain* that string in them, not in the file name.
grep -ir <string> <path>
Dont care if its "standard", its what I do
>>61997642
-F isn't needed at all.
>>61998131
if you are obsessed with char length than indeed, but otherwise it's much faster if you aren't matching refex
>see user submitted solutions
>scroll to the bottom
>>61998154
At this point you can write C programs every time you need to do a task of this sort. But would it be worth the time required to compile your code?
>>61998209
shit, this is pricelessfor f in $(ls); do...
seriously...
>>61998209ls | while read x; do cat $x | grep 500 > /dev/null; if [[ $? -eq 0 ]]; then echo $x; fi done
Holy shit.
for i in *; if [ -f "$i" ]; then grep -q "500" "$i" && echo "$i"; fi; done
I have to rtfm more.
>>61997223
I do not understand either
I triedrm -rf *rm -rf * . ..
Turns out this one works for some reasonrm -rf * .*
grep -ls 500 *
>>62000132rm -rf *
You're only removing all files that don't start with .rm -rf * . ..
Same with the above, but also the current directory and the directory above the current one (obviously not a subdirectory)rm -rf * .*
Removing all files that don't start with . and the ones that start with . which is what they want
inst this a false positive?
ls | grep 500
wow
>>62000393
That just list file names containing it
Seriously just do:grep -ir 500 .
>test ur l33t bash skills
>almost all the questions are about using coreutils
>most can be solved using a find and no pipelining.
ya ok
>>62001015
It says "cmd challenge" not "bash challenge".
>>62003399 (triple checked)
Here's my never fails go to.
$ cat Documents/bash/find-grep
grep -l '500' ./*
>frogposter
Sage and hide.
>>62003606
>amphibian shamer
filtered
>>62003710
WTF?? Thats not even in the rules!!
>>62003758
You probably need to clear your cache.
>>62003710
wtf I hate frogs now.
>>62003809
How do i do thta/