I have a directory with several sub-directories, these sub-directories have many files and I'm interested in *.txt files. I want to go to every sub-directory, read the *.txt file and print a certain line matching a "pattern". I would prefer to have it as a one-liner.
Here is the command what I tried.
for i in $(ls -d *_fastqc); do cd $i; awk '/FAIL/ {print $0}' ls -l su*.txt; done I get an error command for this, as:
awk: cmd. line:1: fatal: cannot open file `-rw-rw-r--' for reading (No such file or directory)
What might be going wrong here?
ls -lshowing long format as input for awk. tryls -1but the link in previous comment is the correct way to go instead of looping.