4

I read the manual of wc command but could not understand the explanation of this parameter. Please help.

The official explanation is below:

--files0-from=F
read input from the files specified by NUL-terminated names in file F; If
F is - then read names from standard input

1 Answer 1

6

read input from the files specified ... in file F

Instead of supplying the filenames to wc on the command line, read them from file F.

NUL-terminated names

The file names in file F must be separated by the NUL character (byte value 0) instead of newlines, tabs or spaces. This is to correctly handle filenames that contain whitespace.

If F is - then read names from standard input

Rather than specifying a real file F, the filenames can be read from standard input which can be fed from a pipe. In this instance, the filenames are still expected to be NUL-terminated. A typical example of this would be find ... -printf0 | wc ... --files0-from=-

2
  • How can you write NUL-terminated file names? Commented Oct 26, 2018 at 22:54
  • 2
    @ivanacorovic, usually the NUL-terminated filenames are the output of another program. For example, the find utility normally returns results separated by newlines but you can use the -printf0 option to have it return results separated by NUL. This is useful when passing filenames with spaces to another program (such as wc in the original question) which treats white space a separators by default. Commented Oct 27, 2018 at 2:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .