0

In this link: https://superuser.com/a/180252/401901

The following command is used:

cat list.txt | xargs -I % echo cp % new_folder

What does the % % usage mean?

All google search results are about using it in a modulo operation. Or, am I searching it in a wrong way?

Also, is there a name for this kind of usage?

Thank you!

sravi
  • 1

1 Answers1

1

From man xargs:

   -I replace-str
          Replace  occurrences  of  replace-str in the initial-arguments with names read
          from standard input.  Also, unquoted blanks do not terminate input items;  in‐
          stead the separator is the newline character.  Implies -x and -L 1.

So it sets up % to be the part of the command which is replaced by the list of files.

l0b0
  • 7,453