[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Copy a file one hundred times



2008/12/14, Rodolfo Medina <rodolfo.medina@gmail.com>:
> I need the right syntax to copy file.jpg 100 times with one command so to
> get
> 100 files named file1.jpg, file2.jpg, ..., file100.jpg.
>
> Can anybody suggest how to achieve that?

You could try something like:

cat file.pdf | tee `seq -w 0 100 | sed 's+.*+file_&.pdf+'` > /dev/null

(1) The "cat" command pipes the contents of the file "file.pdf"
to the command "tee" which can dump the contents of the file
to both a file (or files) and to stdout.

(2) The `seq -w [...]` creates the file names.

(3) The "> /dev/null" is necessary unless you want the contents of
the file to pollute your screen.


Reply to: