[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SHELL] remplacement d'une ligne



Bonjour

voila j'ai le fichier dhcpd.conf suivant (je ne vous en donne qu'une partie):

# option definitions common to all supported networks...
option domain-name "mondomain.com";
option domain-name-servers 192.168.1.254;
default-lease-time 3600;
max-lease-time 7200;
server-name "boom";
  #this is a very basic subnet declaration
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.150;
}
option tftp-server-name "192.168.1.22";
option bootfile-name "/tftpboot/Package1_40/st2030s.txt";
ddns-update-style-none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;



j'ai besoin de trouver un script shell qui me permette de remplacer la ligne
"option bootfile-name "/tftpboot/Package1_40/st2030s.txt";"

je veux faire son remplacement par
"option bootfile-name "/tftpboot/$1/st2030s.txt";"

où $1 est un parametre donné au script.

je veux pouvoir modifier cette ligne en donnant son numero de ligne si possible. c'est la ligne 24 de mon fichier (plus generalement je souhaite savoir comment faire our modifier la ligne d'un fichier en donnant sa ligne).

j'ai essayé avec sed mais c'est une commande assez dure a maitriser.

merci d'avance

Michael




Reply to: