How to display all existing regular file names from a text file?
Example:
$ cat file.txt
zzz
xxx/yyy
234 546
"abc def"
--bbb
$ cat file.txt | <one-liner>
zzz
xxx/yyy
In this list from file.txt regular files zzz and xxx/yyy exist (for example). Hence, the <one-liner> displays zzz and xxx/yyy.
What would be an implementation of this, preferably as a one-liner?
I've quickly tried to play with something like xargs -I {} --max-lines=1 test -f "{}". However, it seems that it's not the right path.
man echo] rather than "print")."abc def"to be treated literally (the filename has those quote characters), or do you expect that to be treated asabc def(the quotes only protect the whitespace)? What happened when you tried yourxargscommands? Do you have example lines in which it failed to work as expected?"abc def"is expected to be treated as file namedabc def."abc def"is expected to be treated as file named"abc def". In my case there are no files with whitespaces nor with quote marks.