On Thu, Jan 18, 2001 at 10:15:55AM -0800, Rob Hudson wrote:
>
>Since I (and probably others) learn best from examples, I thought it
>would be cool if we all could share command line tricks that we've
>picked up and use often. Tricks with perl, awk, sed, xargs and all
>the other unix tools with redirects and pipes - the works.
>
>I've often written things in perl that someone shows me later can be
>done in a single command line using a combination of awk, sed, and
>xargs. Since I don't know much about these tools, and probably a lot
>of the other tools available, maybe we all can share our tricks.
>
Well, you saw my command line to list installed debian packages;
i don't have it on hand here, i'll dig it up from my archives.
A nice function, not quite a command line hack, that i keep in my
.bash_profile:
function where () { type -type ${1+"$@"} | grep -v file 1>&2 ; type -all \
${1+"$@ "} | awk '((NF == 3) && ($3 !~ /\$\*\;/)) {print $NF}' ; }
This will give me a list of available binaries of a certain name,
e.g. on garcia.efn.org:
---
{garcia!pat_e#ttyr3:/home02/members/p/pat_e} 0:507 bash$ where perl
/usr/local/gnu/bin/perl
/bin/perl
/usr/bin/perl
/usr/local/bin/perl
{garcia!pat_e#ttyr3:/home02/members/p/pat_e} 0:508 bash$
---
If we want to get into shell scripts, stevev has a nice WHOIS wrapper
i find very convenient i could post (it's pretty long)
--
"If my son wants to be a pimp when he grows up, that's fine with me. I
hope he's a good one and enjoys it and doesn't get caught. I'll support
him in this. But if he wants to be a network administrator, he's out of
the house and not part of my family." Steve Wozniak, http://www.woz.org