[plug] A bit of gross bash code

Brad Campbell brad at seme.com.au
Wed Mar 7 17:30:57 WST 2001


The Thought Assassin wrote:
> 
> On Wed, 7 Mar 2001, The Thought Assassin wrote:
> > ls -ln /dev|grep "^[c|b|u]" |
> > sed 's/^\(.\)......... *\([0-9]*\) *\([0-9]*\) *\([0-9]*\) *\([0-9]*\)\, *\([0-9]*\)..............\(.*\)$/\1:\3:\4:\5:\6:\7/'
> 
> It occurs to me that your mailreader will probably linewrap this at a
> convenient space character. Don't cut+paste and leave that space character
> out, or it will not work as intended.
> 
> -Greg

Thanks to both Tony and Greg for the ideas..
I'm off to read up on regular expressions..
I knew there had to be a better way to do it, I now have a basic understanding
of grep, sed, tr and awk, although the latter I'm still working on.
I have a feeling that once I get on top of regexps it will all fall into place.
Maybe thats a good topic for a plug talk one night.
One good source of bash code I have found to disassemble is debian boot scripts.

Thanks again all, I'll be sure to post another basic question some time in the
near future..

-- 
Brad....
                   /"\
Save the Forests   \ /     ASCII RIBBON CAMPAIGN
Burn a Greenie.     X      AGAINST HTML MAIL
                   / \



More information about the plug mailing list