7. OS X
sed - convert regex pattern matches to lowercase #
In this example, we'll convert text within bold tags to lowercase. Let's have a look first to make sure our search pattern returns the desired results:
$ grep '<b>.*<\/b>' foo.html <p><a href="/">tinyapps.org</a> / <b>Graphics</b></p> <p><b>Viewing & Editing</b></p> <p><b>Measuring</b></p> <p><b>Optimizing</b></p> <p><b>Screen Capture</b></p> <p><b>Fonts</b></p> <p><b>Other</b></p>Next, a test run, sending output to stdout:
$ sed 's/<b>.*</b>/\L&/g' foo.htmlAs expected, all characters between bold tags were converted to lowercase. (In the replacement pattern, "&" corresponds to the pattern found, and "\L" converts the text to lowercase.) Now let's use -i to write the changes in place (apparently introduced around GNU sed version 4):
$ sed -i 's/<b>.*</b>/\L&/g' foo.htmlFor batch processing multiple files:
$ grep '<b>.*<\/b>' *.html ... $ for i in '*.html'; do sed -i "s/<b>.*</b>/\L&/g" $i; doneTwo related tips by Karoly: 1. Use double quotes so the shell can substitute variables. 2. If your search or replace string contains special characters you need to escape them.
/nix | May 19, 2013Tiny database #
"KISSDB is about the simplest key/value store you'll ever see, anywhere. It's written in plain vanilla C using only the standard string and FILE I/O functions, and should port to just about anything with a disk or something that acts like one." Code generously released into the public domain.
/nix | Apr 23, 2013Newly added to Docs #
SCO OpenServer P2V; or, How to Virtualize a SCO Box. Virtualizing a physical SCO OpenServer 5 box turns out to be quite straightforward thanks to VirtualBox.
/nix | Apr 14, 2013View ddrescue log files graphically #
ddrescueview displays ddrescue log files as a colored grid of blocks. Pascal source code available, as well as binaries from Linux and Windows. See ddrescue binary for OS X and Imaging a corrupt drive for more on ddrescue.
/nix | Apr 10, 2013Changing text mode resolution in Knoppix #
For larger console text when booting Knoppix Linux into runlevel 2 (text mode), disable graphics acceleration modules:
boot: knoppix 2 nodrm(Thank you don999!)
/nix | Apr 02, 2013A lightweight IMAP email client #
that resembles OS X's Mail 5.x app, Geary integrates tightly with popular webmail services and IMAP servers like Dovecot. Features include desktop notifications, fast search, offline mode, and more.
/nix | Feb 04, 2013Backing up IMAP email accounts #
NoPriv.py backs up IMAP email accounts to browsable HTML archives. Additional features include incremental backups, Maildir creation (for easy restoring), and more.
/nix | Jan 19, 2013Download videos from YouTube, Metacafe, Daily Motion, Vimeo, #
and many more with Movgrab. It's written in straight C with no dependencies; building is as simple as ./configure && make. Usage example:
$ movgrab -T 'http://www.youtube.com/watch?v=7XEujPG7Zjw'
/nix | Oct 23, 2012Tiny web browser #
reminiscent of the QNX Demo Disk and OffByOne: NetSurf 2.9. Key features include speed, lean system requirements, portability, and standards compliancy. In addition to C source code (which compiles nicely under Linux and other *nixes), binaries are available for AmigaOS, Atari, Haiku / BeOS, OS X, and RISC OS. (via Seth Fulton)
/nix | Jul 31, 2012Effortlessly build a custom Linux Live CD #
and boot it instantly from a cloud-based virtual machine with SUSE Studio. Share your results with the world in one click. I put together a bare-bones 32-bit openSUSE 12.1 image for data recovery that includes:
/nix | Jul 10, 2012
2013: 5 4 3 2 1
2012: 12 11 10 9 8 7 6 5 4 3 2 1
2011: 12 11 10 9 8 7 6 5 4 3 2 1
2010: 12 11 10 9 8 7 6 5 4 3 2 1
2009: 12 11 10 9 8 7 6 5 4 3 2 1
2008: 12 11 10 9 8 7 6 5 4 3 2 1
2007: 12 11 10 9 8 7 6 5 4 3 2 1
2006: 12 11 10 9 8 7 6 5 4 3 2 1
2005: 12 11 10