<p>I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp.  Ideally, the use would be something like:</p>

<pre><code>cat somefile.txt | prepend-timestamp
</code></pre>

<p>(Before you answer sed, I tried this:</p>

<pre><code>cat somefile.txt | sed "s/^/`date`/"
</code></pre>

<p>But that only evaluates the date command once when sed is executed, so the same timestamp is incorrectly prepended to each line.)</p>

How about this?
```
```
cat somefile.txt | perl -pne 'print scalar(localtime()), " ";'
```
```
Judging from your desire to get live timestamps, maybe you want to do live updating on a log file or something?  Maybe
```
```
tail -f /path/to/log | perl -pne 'print scalar(localtime()), " ";' > /path/to/log-with-timestamps
```
```