Greetings Stack Exchange,
My Goal:Execute ls
to search the entire directory structure and grep
to search for cats.py
. Use cat
to read the file cats.py
. I know that sounds like Gnu/Linux inception.
I currently am new to bash
and not really familiar with Stack Exchange so forgive me if this formatted terribly.
I execute the following ls -R -l -t -r | grep cats
this returns the following
rw-r--r-- 1 user user 2179 Mar 18 08:53 cats.py
I have tried to use cat to read the file returned above, but I am having issues with how to assign the placeholder for the results of the grep command this is what I have tried and the results.
ls -R -l -t -r | grep cats | cat cats.py
cat: cats.py: No such file or directory
I believe the issues is the way I am executing the cat function should this look something like :
ls -R -l -t -r | grep cats | cat '{}'
or
ls -R -l -t -r | grep cats && cat cats.py
ls
– pLumo Mar 25 '20 at 11:39