Brian Fundakowski Feldman <[EMAIL PROTECTED]> writes:

> I made a sed script to ease migration of kernel configuration files from
> the few-weeks-ago-CURRENT to current-CURRENT, and thought I might as well
> share it since it makes things easy (autonomous :)
> 
> You can find it at
>       http://people.freebsd.org/~green/oldconfig2new
> It requires extended regular expression support (because old regexps
> are so cumbersome to actually _use_), so for example:
>       mv GREEN GREEN.old
>       perl gethints.pl GREEN
>       sed -Ef oldconfig2new GREEN.old > GREEN

this one seems to be working w/ a standard sed :

==========----------========== CUT HERE ==========----------==========
#!/usr/bin/sed -f

# since ata[0-9] requires ata alone, delete them.
/^#*[ \t]*device[ \t]\{1,\}ata[0-9]\{1,\}/d

# delete fd[0-9] and fd alone.
/^#*[ \t]*device[ \t]\{1,\}fd[0-9]\{1,\}/d
/^#*[ \t]*device[ \t]\{1,\}fd$/d

# get rid of terminal spaces
s/[ \t]\{1,\}$//

# hints stuffs
/^ident[ \t]\{1,\}/ {
        h
        s/^ident\([ \t]\{1,\}\)\([a-zA-Z0-9_]\{1,\}\)/hints\1"\2.hints"/
#                                 ^^^^^^^^^^ I'm not sure about this
#       are underscore and digits valid characters here ?
        H
        x
}
s/^\(#*[ \t]*\)pseudo-device\([ \t]\{1,\}\)/\1device\2/
s/^\(#*[ \t]*\)device\([ \t]\{1,\}\)\([a-zA-Z_]\{1,\}\)\([0-9]\{1,\}\)\([ 
\t]*\)\([^#]*\)\(.*\)$/\1device\2\3\5\7/
#                                      ^^^^^^^ also, here ?

==========----------========== CUT HERE ==========----------==========

\t need to be replaced w/ real tabs (under vi, :%s/\\t/<TAB>/g)
just in case, I put them here to be reliable (and visible :) via email.

Cyrille.
-- 
home:mailto:[EMAIL PROTECTED] Supprimer "no-spam." pour me repondre.
work:mailto:[EMAIL PROTECTED] Remove "no-spam." to answer me back.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to