Please help solve the problem.
There is a directory lab0 , in which there are files and more directories.

The task:

Recursively output the contents of files with line numbers from the lab0 directory, whose names begin with d , sort the lines by the name a -> z , redirect access errors to a file in the /tmp

I tried to do this:

 grep -hn '^d' ~/lab0/ | sort -t: -k2d 2>/tmp/err 

But after the execution of the command, the terminal simply says nothing:

terminal

  • one
    "Just silent" - this is because the grep's abuse to the wrong argument was sent to /tmp/err . And so he is not silent, but very informatively informs where the error is. - Alexander Prokoshev
  • If you remove the redirection, the result is the same - Anton
  • one
    You also need to choose file names starting with 'd' , so grep not suitable here. Read man find - avp
  • You confuse the first letter of the file name with its contents . See, there must be something like sort $(find lab0 -mindepth=1 -maxdepth=1 -type f -name '^d*' 2>/tmp/err) . - 0andriy

0