View on GitHub

Lorem

A dummy text generator and text replacement power tool that inserts text in existing files, creates new text files, and writes text to the standard out stream.

Download this project as a .zip file Download this project as a tar.gz file

Updates

Updated to provide you with the ability to specify your own text blocks for insertion into files at the <lorem> tag. Lorem will wrap your text with any characters/tags/strings that you'd like (if so desired) and insert repeat blocks of your text (up to 1 million repetitions!) into the recipient text file. See the use examples or type lorem -h for more information.

Installation

Download the source from one of the links to the right above. Unpack the source and open your terminal in the main source directory. Then enter the following on the command line:

./configure
make
sudo make install

If you get an error, you likely need to update GNU Automake on your system. You can download and install updated packages through your package manager or on the GNU ftp site.

You can confirm that it is installed by checking the help with the following command:

lorem -h

If it worked, it works! Now you can generate more dummy text than you ever thought possible!

If all else fails, you can build the source with the following command (assuming that you have gcc):

gcc lorem.c -std=gnu99 -O3 -Wall -g -o lorem

Manually move the lorem binary into a directory on your PATH or use it from the directory where you compiled it like this:

./lorem

Use Examples

Create a New File with Lorem Ipsum Dummy Text

To create a new file named 'eg.txt' with 5 paragraphs of dummy text, use the following command:

lorem -n 5 -o eg.txt

Create a New File with Your Own Text

To create a new file called 'eg.txt' with 10 'blocks' of text that you specify in the file located at 'path/to/inserttext.txt'

lorem -n 10 -t path/to/inserttext.txt -o eg.txt

Append Lorem Ipsum Dummy Text to an Existing Text File

To append 7 paragraphs of lorem ipsum text to an existing text file named 'eg.txt', use the following command:

lorem -a -n 7 -o eg.txt

Append Your Own Text to an Existing Text File

To append 15 'blocks' of your own text that is located in the file 'path/to/inserttext.txt' to an existing text file named 'eg.txt', use the following command:

lorem -a -n 15 -t path/to/inserttext.txt -o eg.txt

Insert Lorem Ipsum Dummy Text into a Specific Location in an Existing Text File

Say you have the following html file named 'eg.html':

Add the delimiter <lorem> to the file like this (it's between the p tags):

Then run the following to insert 1 paragraph of lorem text at the site of the <lorem> delimiter (no need to specify -n in this case, the default is one paragraph):

lorem -r -i eg.html

And here is what you get:

Rinse and repeat as desired.

Insert Your Own Text into a Specific Location in an Existing Text File and Wrap with Tags

Let's use the same 'eg.html' file that we did in the example above, however, this time we will add blocks of Samuel L. Jackson ipsum (kindly provided by http://slipsum.com). The Samuel L. Jackson ipsum is located in the file 'path/to/samuel.txt'. That file looks like this:

Now let's insert ten paragraphs of that quote and wrap each of the paragraphs with a p tag that includes a 'samuel' class. This will be replaced in the location of the <lorem> tag in the recipient text document. Perform this amazing feat like so:

lorem -r -n 10 -t path/to/samuel.txt -i eg.html -b "<p class='samuel'>" -e "</p>"

And here is the result:

Note how we used the -b and -e options to specify the tags at the beginning and end of each block of text. You can insert any character or string around each of the paragraphs that are inserted into the recipient text document.

Pipe Large Blocks of Text to Another Application

Lorem will generate and write up to one million paragraphs of dummy text to the standard out stream. That's over 69 million Latin words (>467 MiB)! Feel free to bring your own text and write up to 1 million blocks of it to the standard out stream as well. Pipe it to whatever you like. No need to save massive text files on your drive for testing purposes.

To pipe 1 million paragraphs of lorem text to wc and count the characters:

lorem -s -n 1000000 | wc -c

To pipe 1 million blocks of your own text that is located on a path 'path/to/myfile.txt' to wc for a character count:

lorem -s -n 1000000 -t path/to/myfile.txt | wc -c

Help

Enter the following for help:

lorem -h

All of the available options are detailed.

Problems

Please report bugs, issues, and submit requests for further information here.