I'm creating a list of file-names using the command:
ls | grep "\.txt$"
I'm getting a list of files:
I want to view the content of these files (using less / more / cat /...)
is there a way to do this by pipping?
(Btw, i got a list of file-names using a more complex command, this is just a simpler example for clarification)
Would this be enough?
$ cat *txt
For richer queries, you could use
$ find . -name "*txt" | xargs cat
you can try something like this:
#!/bin/bash for i in *.txt do echo Displaying file $i ... more $i done
cat $(ls | grep "\.txt$")