Add words to beginning of file with sed

A few days ago I needed to add a few words to the beginning of each line in a really large file (53,232 lines).

Using a text editor would take a lot of time, so I used the powerfull sed command:

sed 's/^/Your words /' large_file > new_large_file

And that takes less than a second.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s