[mrtg] Re: MRTG and Linux

Drash, Jim [EESUS] JDrash at EESUS.JNJ.com
Wed Jan 24 17:24:49 MET 2001


Removing carriage returns is as simple as running:

sed 's/.$//g' file > file2
or 
sed 's/^M//g filed > file2 (The "^M" is Ctrl-V ctrl-M in bash or sh)


-----Original Message-----
From: Brian E. Seppanen [mailto:seppy at chartermi.net]
Sent: Wednesday, January 24, 2001 9:32 AM
To: Mark Campbell
Cc: mrtg at list.ee.ethz.ch
Subject: [mrtg] Re: MRTG and Linux



the tr command in unix/linux translates characters, so you would do

#man tr
 or
#info tr

info tr has much more documentation.

That being said you could do something like this, utilizing unix/linux's
great redirection/piping capabilities

cp mrtg.cfg mrtg.cfg.test
cat mrtg.cfg.test | tr -d \r > mrtg.cfg.good
                 PIPE       REDIRECT -> new file

However, you see actual occurrences of ^M, so you may have to use escape
characters, and not actually remove newlines.  the \ is an escape
character.  so this might work tr -d \^M.  You may have to play aroud
with the pattern matching a bit.  If you need more background on what tr
is doing you might  also want to look at sed, awk, grep as each of these
delve heavily into pattern matching.  sed may actually be better at doing
what you propose.  Man is man's best friend.

Don't mean to sound patronizing, I just have no idea how comfortable with
linux/unix you are.

hope that helps.


On Wed, 24 Jan 2001, Mark Campbell wrote:

>
> Hi all,
>
> I import mrtg.cfg files from my NT server to my Linux box using wget.  My
> problem is the way the files come accross doesn't seem to gel with Linux
> because MRTG gives this error;
>
> root at root:/tmp/cfg# perl /usr/local/mrtg/bin/mrtg mrtg.cfg
> ) in CFG file (mrtg.cfg)  does not make sense
> root at root:/tmp/cfg#
>
> I use these exact same config files on my NT box to graph.  My guess is
that
> it has something to do with word wrapping, because sometimes i'll get a
file
> with a ^M at the end of every line or the file has big spaces between the
> lines after an import.  Also when I copy and paste a config file from NT
> into Linux using VI and SSH it works great. Is there a way I can get MRTG
to
> ingnore these ^M's and spaces?
>
> Any ideas?  My goal is to create the config files using my NT box and
> getting my Linux box to import them periodically using wget and running
mrtg
> from Linux.
>
> Thanks!!!
>
> Mark Campbell
> Unihold Internetworking Services
> Tel - +27 11 380 4760
> Fax - +27 11 380 4710
> Cell - 0833269321
> Email - mark at uis.co.za
>
> --
> Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
> Archive     http://www.ee.ethz.ch/~slist/mrtg
> FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>

Brian Seppanen
Charter Communications
Regional Data Center				906-228-4226 ext 23
Marquette, MI					seppy at chartermi.net


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list