[CS-FSLUG] Shell Scripting A Solution to Network Monitoring

Josiah Ritchie jritchie at bible.edu
Tue Aug 3 08:39:37 CDT 2004


On Mon, 2004-08-02 at 21:39, Robert W. wrote:
> On 08/02/2004 07:45:50 AM, Josiah Ritchie wrote:
> > OOhh... I figured there was a cleaner way of doing this.
> > 
> > What does gsub("[;\"]", "", host) do?
> >
> 
> 'gsub' removes all of the semi-colons and quotation marks from the  
> string.  Technically, it replaces anything that mathces the first  
> regular expression (semi-colon or quotation mark) with the second  
> string (null).  That command took the place of 'tr -d "\""|tr -d ";"'  
> in the shell command line.

That's very useful. Thanks for sharing. I played around with it a bit
yesterday. The accomplishment that especially thrilled me was piping the
output into "columns -t" for a neat/organized appearance. Reading up in
_Unix Power Tools_ indicates that I can do the same thing with awk, but
I haven't done more than notice the section yet.

The more I learn about awk, the more I'm impressed. It's like the emacs
of shell scripting. (It does lots of things inside one program that is
already available in many others.)

JSR/





More information about the Christiansource mailing list