Alan Hargreaves' Weblog
The ramblings of an Australian SaND TSC* Principal Field Technologist
* Solaris and Network Domain Technology Support Centre - The group I work forTags
(update 1) acoustic bind birthday blues bugs cec cec2007 cec2008 china cmt contention cringley debugging dogs dtrace earthquake encumbered-binaries extra flash funny google guitar halloween huron install kids linux liveupgrade locking mdb music mysql newyear niagra openjava opensolaris oracle patches patents percussion performance redhat secondlife security solaris sru sun support sxcr t2 t2000 timeslider ufs upgrade virtualbox windows youtube zfs
Friday Jul 09, 2004
Man-Ching's ksh scripts
Interesting scripts, but I have another solution to the splitting problem using IFS.
I offer the following, which should work in vanilla bourne shell, with the using the same delimeters as Man-Ching used.
pl.sh
#!/bin/sh line="$@" # Save the argument list IFS="|" # Make '|' the field seperator set -- $line # reset the argument list for column # loop through $* do echo $column done
Giving the same result
./pl.sh `head -1 /etc/passwd | sed 's/:/|/g'` root x 0 1 Super-User / /sbin/sh
Indeed you could do the whole part in grave accents in a single sed command.
./pl.sh `sed -e 's/:/|/g' -e 1q /etc/passwd` root x 0 1 Super-User / /sbin/sh
Which actually goes to demonstrate a bit of unix philosopy. That is, there are many ways to achieve the same end; none is necesarily the best, or more simply, there is more than one right way to do anything.
Posted at 06:42PM Jul 09, 2004 by Alan Hargreaves in Solaris |
Great Dtrace article on The Register
Fired up The Register this morning to find the first article that I come across is an interview with Bryan and Adam titled Sun delivers Unix shocker with DTrace
There are also a real uses in the article from Brendon Gregg and Aeysis' Jenson.
Good interview guys!
Posted at 08:59AM Jul 09, 2004 by Alan Hargreaves in Solaris Express |

