Friday, September 02, 2005

Making an Arbitrary-Size File for Testing

51.11 Making an Arbitrary-Size File for Testing

The yes command (23.4) outputs text over and over. If you need a file
of some size for testing, make it with yes and head (25.20). For
example, to make a file 100k (102,400) characters long, with 12,800
8-character lines (7 digits and a newline), type:

% yes 1234567 | head -12800 > 100k-file

NOTE: On some UNIX systems, that command may "hang" and need to be
killed with CTRL-c - because head keeps reading input from the pipe.
If it hangs on your system, replace head -12800 with sed 12800q.

- JIK, JP

0 Comments:

Post a Comment

<< Home