# repeat content of text x time

I have a use-case where 1 have single file that contain 20K line. I need to have another file with 1 million line with just content of the first file repeated 50 time.

Solution: form [stack overflow](http://askubuntu.com/questions/521465/how-can-i-repeat-the-content-of-a-file-n-times)

```
$ perl -0777pe '$_=$_ x 50' input_file.txt > output_file.txt
```

arguments:

* 0777 : -0 sets sets the input record separator (perl special variable $/ which is a newline by default). Setting this to a value greater than 0400 will cause Perl to slurp the entire input file into memory.
* pe : the -p means "print each input line after applying the script given by -e to it".
* $*=$* x 50 : $\_ is the current input line. Since we're reading the entire file at once because of -0700, this means the entire file. The x 50 will result in 50 copies of the entire file being printed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://til.yulrizka.com/unix/repeat-content-of-text-x-time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
