Reputation: 917
I am trying to store the resulting list from "ls -la" into a variable then filter out some files name, after that print out only the filtered file names (along with the date and stuff like how ls -la does it" again, but when I do that everything is in one line, is there a way to make sure every file name are on different lines?
thanks in advance
Upvotes: 0
Views: 521
Reputation: 342293
if you want to filter file names, eg , don't list all txt files
shopt -s extglob
ls !(*.txt)
Upvotes: 4
Reputation: 332756
Use a pipe instead of storing it in a variable.
ls -la | filter
Where filter
is whatever you're using to filter.
That's about as good an answer as I can give unless you can provide some more details on exactly what you're trying to do.
Upvotes: 4