Corrupt dhcpd.conf file

Ausmus, Matt mausmus at chapman.edu
Thu Jan 7 01:06:55 UTC 2010


To Alan, thank you for the useful information.  I really appreciate
that.

To Glen & Simon,

If you'd read my question you'd see that I already know vi and have been
using it for years.  I force my student workers to learn it as well
instead of using nano or any of the others because that is the one text
editor that will always be on a *nix box no matter what.

In this particular case, I was combining 4 dhcp servers into a single
failover pair.  This meant copying reservations and other information
from multiple files into a single file.  As is a reality in the
workplace, my desktop is a PC running Winders (as dictated by
management) and my laptop runs OS X & XP.  I do have gVim installed on
all of these.  I used Notepad++ because it is supposedly a true text
editor but it supports tabs which made it infinitely easier to move all
that information into a single file.  In this case it bit me in butt and
I ended up building the config (at least the barebones of it) using the
text based version of vim on the CentOS dhcp server.

So while I appreciate the fact that you both responded back and tried to
be helpful, it just came out with no particular answer to my question
and more a zealot's diatribe on the wonder that is vi. 

____________________________
Matt Ausmus
mausmus at chapman.edu
 
"What the gods get away with, the cows don't."
-THE AQUINAS AXIOM

-----Original Message-----
From: Simon Hobson [mailto:dhcp1 at thehobsons.co.uk] 
Sent: Wednesday, January 06, 2010 12:56 PM
To: Users of ISC DHCP
Subject: Re: Corrupt dhcpd.conf file

Glen R. J. Neff wrote:

>Honestly though, I'd get a copy of 'vilearn' and just learn vi.  You 
>can be a vi expert in give easy lessons.  There's nothing faster or 
>easier, once you give it a little time.

Expert in five easy lessons ? I'd say that anyone who is happy 
managing a DHCP config of that complexity can lean the basics of vi 
in a few minutes - but I believe it's one of those "learned in an 
hour, mastered in a lifetime" things (like backgammon).

Certainly I've managed to teach our helpdesk people the basics of vi 
- they've stopped asking how to quit without saving now :-/


Actually, I think the basic commands you need to know are just :

(from the shell) "vi filename" to edit file called filename

i - insert (before current char), a - append (after current char), 
esc to exit insert/append mode
x - delete char under cursor, dd - delete current line
o - new line after current, O - new line before current

:q! - quit without saving, :x - save and exit
:x! - force save (override permissions if you are root)

That's ten commands that will allow you to do basic editing. Commands 
that start with ':' are ones where you type in a command string and 
it appears at the bottom of the screen - hit enter to execute it. The 
rest are instant.


Getting more useful :
A - Append at end of line, I - insert at beginning of line
r - replace for single character, R - replace until you exit
u - undo single edit, U - undo all changes on current line
nG - goto line n in file, G - goto end of file
. - repeat last edit (that's a single full stop)
:w - write file without exiting

Search :
/string - search forwards for string, ?string - search backwards for
string
n - find next
:g/string1/s//string2/g - find all occurrences of string1 and replace 
them with string2, without the 'g' on the end only changes first 
occurrence on a line

I'd say that accounts for probably 99% of my editing in vi

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.




More information about the dhcp-users mailing list