Skip to main content
Became Hot Network Question
added 16 characters in body; edited title
Source Link
pmor
  • 675
  • 7
  • 17

How to display all existing regular files from a text file using one-liner?

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.

How to display all existing files from a text file using one-liner?

How to display all existing 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 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.

How to display all existing regular files from a text file using one-liner?

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.

Clarified requirements. No need for "update" as all questions have full history available
Source Link
Chris Davies
  • 128k
  • 16
  • 178
  • 323

How to display all existing filesfile names from a text file using one-liner?

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 files zzz and xxx/yyy exist (for example). Hence, the <one-liner> displays zzz and xxx/yyy.

What would be an implementation of thethis, 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.


UPD. Replace "print" with "display".

How to display all existing files from a text file using one-liner?

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 files zzz and xxx/yyy exist (for example). Hence, the <one-liner> displays zzz and xxx/yyy.

What would be an implementation of the 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.


UPD. Replace "print" with "display".

How to display all existing 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 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.

added 51 characters in body; edited title
Source Link
pmor
  • 675
  • 7
  • 17

How to printdisplay all existing files from a text file using one-liner?

How to printdisplay all existing files from a text file using one-liner?

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 files zzz and xxx/yyy exist (for example). Hence, the <one-liner> printsdisplays zzz and xxx/yyy.

What would be an implementation of the 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.


UPD. Replace "print" with "display".

How to print all existing files from a text file using one-liner?

How to print all existing files from a text file using one-liner?

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 files zzz and xxx/yyy exist (for example). Hence, the <one-liner> prints zzz and xxx/yyy.

What would be an implementation of the 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.

How to display all existing files from a text file using one-liner?

How to display all existing files from a text file using one-liner?

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 files zzz and xxx/yyy exist (for example). Hence, the <one-liner> displays zzz and xxx/yyy.

What would be an implementation of the 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.


UPD. Replace "print" with "display".

Source Link
pmor
  • 675
  • 7
  • 17
Loading