I'd do something like
command | sed -e 's/^/line-prefix /'
example
$ ls -la m* | sed -e 's/^/#> /'
#> -rwxr-xr-x 1 root root 76080 Aug 11 2011 mailstats
#> -r-xr-xr-x 1 root root 92824 Aug 11 2011 makemap
#> -rwxr-xr-- 1 root root 12389 Jul 22 2011 makewhatis
#> -rwxr-xr-x 1 root root 11520 Mar 6 2011 matchpathcon
#> -rwxr-xr-x 1 root root 56600 May 18 2011 mcelog
#> lrwxrwxrwx 1 root root 15 Mar 18 2011 mkdict -> cracklib-format
#> -rwxr-xr-x 1 root root 9600 Jul 22 2011 mklost+found
#> -rwxr-xr-x 1 root root 10176 Jan 6 2007 mksock
#> -rwxr-xr-x 1 root root 4409 Jan 7 2007 modeline2fb
#> -rwxr-xr-x 1 root root 23787 Jul 22 2011 mountstats
#> -rwxr-xr-x 1 root root 58032 Jan 7 2007 mtr
You can also apply this to a shell so it is done automatically
$ ksh | sed -e 's/^/#> /'
$ ls m*
#> mailstats
#> makemap
#> makewhatis
#> matchpathcon
#> mcelog
#> mkdict
#> mklost+found
#> mksock
#> modeline2fb
#> mountstats
#> mtr
There's probably some drawbacks/gotchas, take care with this.
A different approach is to run script
(see man script
) and then use your favourite editor (or a small perl/awk/etc script) to make it markdown-friendly - In vim I'd just do something like :%s/^/#> /
to fix all the lines in one go. Then I'd insert markdown headers etc.