Created
December 13, 2011 16:00
-
-
Save jerodsanto/1472671 to your computer and use it in GitHub Desktop.
Printing the $PATH with each entry on a separate line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using ruby: | |
$ echo $PATH | ruby -e 'STDIN.read.split(":").each { |l| puts l }' | |
$ echo $PATH | ruby -e 'print STDIN.read.gsub(":", "\n")' | |
# Using sed: I would expect this to work, but it does not | |
$ echo $PATH | sed 's/:/\n/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@sant0sk1 awk is a little gem. Nothing beats it when processing large amounts of text. Single process, no optimizations whatsoever:
That was on 4 x SAS as a software RAID5. With a few tweaks, that would become a 5min jobbie. Now imagine running that on SSDs or shared memory : ).
My most recent pride is awk scripts wrapped in shell commands, running as upstart jobs, leveraging redis pipelines to feed graphite with metrics every n seconds. All minitested, sub second for the whole test suite. I'm getting a hard-on just talking about it :D.