I’ve always been a big perl fan.
Just ran into another case, where I dusted off some old dusty synapses and did a little perl oneliner.
Given a pile of text files, prepend each line of each file with a ‘* ‘ (to make it handy for a markdown list.
find . -name '*.txt' -print0 | xargs -0 perl -pi -e '$_ = "* $_"'
done and done.
A file like this
now looks like this
* line 1
* line 2
* line 3
And it hit every text file (*.txt) in this directory and below.
If you haven’t played with perl oneliners (or ruby oneliners for that matter) check out these resources: