# 文件内容
cat dhcpcode93配置.txt
# Type,Architecture Name,Reference
# 0x00 0x00,x86 BIOS,[RFC5970][RFC4578]
# 0x00 0x01,NEC/PC98 (DEPRECATED),[RFC5970][RFC4578]
# 0x00 0x02,Itanium,[RFC5970][RFC4578]
# 0x00 0x03,DEC Alpha (DEPRECATED),[RFC5970][RFC4578]
# 0x00 0x04,Arc x86 (DEPRECATED),[RFC5970][RFC4578]
# 0x00 0x05,Intel Lean Client (DEPRECATED),[RFC5970][RFC4578]
# 0x00 0x06,x86 UEFI,[RFC5970][RFC4578]
# 0x00 0x07,x64 UEFI,[RFC5970][RFC4578]
# 0x00 0x08,EFI Xscale (DEPRECATED),[RFC5970][RFC4578]
# 0x00 0x09,EBC,[RFC5970][RFC4578]
# 0x00 0x0a,ARM 32-bit UEFI,[RFC5970]
# 0x00 0x0b,ARM 64-bit UEFI,[RFC5970]
# 0x00 0x0c,PowerPC Open Firmware,[Thomas_Huth]
# 0x00 0x0d,PowerPC ePAPR,[Thomas_Huth]
# 0x00 0x0e,POWER OPAL v3,[Jeremy_Kerr]
# 0x00 0x0f,x86 uefi boot from http,[Samer_El-Haj-Mahmoud]
# 0x00 0x10,x64 uefi boot from http,[Samer_El-Haj-Mahmoud]
# 0x00 0x11,ebc boot from http,[Samer_El-Haj-Mahmoud]
# 0x00 0x12,arm uefi 32 boot from http,[Samer_El-Haj-Mahmoud]
# 0x00 0x13,arm uefi 64 boot from http,[Samer_El-Haj-Mahmoud]
# 0x00 0x14,pc/at bios boot from http,[Samer_El-Haj-Mahmoud]
# 0x00 0x15,arm 32 uboot,[Joseph_Shifflett]
# 0x00 0x16,arm 64 uboot,[Joseph_Shifflett]
# 0x00 0x17,arm uboot 32 boot from http,[Joseph_Shifflett]
# 0x00 0x18,arm uboot 64 boot from http,[Joseph_Shifflett]
# 0x00 0x19,RISC-V 32-bit UEFI,[Dong_Wei]
# 0x00 0x1a,RISC-V 32-bit UEFI boot from http,[Dong_Wei]
# 0x00 0x1b,RISC-V 64-bit UEFI,[Dong_Wei]
# 0x00 0x1c,RISC-V 64-bit UEFI boot from http,[Dong_Wei]
# 0x00 0x1d,RISC-V 128-bit UEFI,[Dong_Wei]
# 0x00 0x1e,RISC-V 128-bit UEFI boot from http,[Dong_Wei]
# 0x00 0x1f,s390 Basic,[Hendrik_Brueckner]
# 0x00 0x20,s390 Extended,[Hendrik_Brueckner]
# 0x00 0x21,MIPS 32-bit UEFI,[Jiading_Zhang]
# 0x00 0x22,MIPS 64-bit UEFI,[Jiading_Zhang]
# 0x00 0x23,Sunway 32-bit UEFI,[Jiading_Zhang]
# 0x00 0x24,Sunway 64-bit UEFI,[Jiading_Zhang]
# 0x00 0x25,LoongArch 32-bit UEFI,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
# 0x00 0x26,LoongArch 32-bit UEFI boot from http,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
# 0x00 0x27,LoongArch 64-bit UEFI,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
# 0x00 0x28,LoongArch 64-bit UEFI boot from http,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
# 0x00 0x29,arm rpiboot,[Peter_Harper][https://www.raspberrypi.com/documentation/computers/remote-access.html#network-booting-using-ipv6]
# 0x00 0x2a-0xff 0xff,Unassigned,
### sed 处理 每一行截取特定内容,并为每一行添加下一行, 添加的内容含有截取的特定内容; 思路:hold一份;处理一份;x交换;G追加下一行
sed -i '/.*/h; s/.* 0x\(.[a-z0-9]\),.*/if option pxe-system-typee = 00:\1 { \n\t#filename\n}/;x;G;' dhcpcode93配置.txt
# 结果
cat dhcpcode93配置.txt
# Type,Architecture Name,Reference
# 0x00 0x00,x86 BIOS,[RFC5970][RFC4578]
if option pxe-system-type = 00:00 {
#filename
}
# 0x00 0x01,NEC/PC98 (DEPRECATED),[RFC5970][RFC4578]
if option pxe-system-type = 00:01 {
#filename
}
# 0x00 0x02,Itanium,[RFC5970][RFC4578]
if option pxe-system-type = 00:02 {
#filename
}
# 0x00 0x03,DEC Alpha (DEPRECATED),[RFC5970][RFC4578]
if option pxe-system-type = 00:03 {
#filename
}
# 0x00 0x04,Arc x86 (DEPRECATED),[RFC5970][RFC4578]
if option pxe-system-type = 00:04 {
#filename
}
# 0x00 0x05,Intel Lean Client (DEPRECATED),[RFC5970][RFC4578]
if option pxe-system-type = 00:05 {
#filename
}
# 0x00 0x06,x86 UEFI,[RFC5970][RFC4578]
if option pxe-system-type = 00:06 {
#filename
}
# 0x00 0x07,x64 UEFI,[RFC5970][RFC4578]
if option pxe-system-type = 00:07 {
#filename
}
# 0x00 0x08,EFI Xscale (DEPRECATED),[RFC5970][RFC4578]
if option pxe-system-type = 00:08 {
#filename
}
# 0x00 0x09,EBC,[RFC5970][RFC4578]
if option pxe-system-type = 00:09 {
#filename
}
# 0x00 0x0a,ARM 32-bit UEFI,[RFC5970]
if option pxe-system-type = 00:0a {
#filename
}
# 0x00 0x0b,ARM 64-bit UEFI,[RFC5970]
if option pxe-system-type = 00:0b {
#filename
}
# 0x00 0x0c,PowerPC Open Firmware,[Thomas_Huth]
if option pxe-system-type = 00:0c {
#filename
}
# 0x00 0x0d,PowerPC ePAPR,[Thomas_Huth]
if option pxe-system-type = 00:0d {
#filename
}
# 0x00 0x0e,POWER OPAL v3,[Jeremy_Kerr]
if option pxe-system-type = 00:0e {
#filename
}
# 0x00 0x0f,x86 uefi boot from http,[Samer_El-Haj-Mahmoud]
if option pxe-system-type = 00:0f {
#filename
}
# 0x00 0x10,x64 uefi boot from http,[Samer_El-Haj-Mahmoud]
if option pxe-system-type = 00:10 {
#filename
}
# 0x00 0x11,ebc boot from http,[Samer_El-Haj-Mahmoud]
if option pxe-system-type = 00:11 {
#filename
}
# 0x00 0x12,arm uefi 32 boot from http,[Samer_El-Haj-Mahmoud]
if option pxe-system-type = 00:12 {
#filename
}
# 0x00 0x13,arm uefi 64 boot from http,[Samer_El-Haj-Mahmoud]
if option pxe-system-type = 00:13 {
#filename
}
# 0x00 0x14,pc/at bios boot from http,[Samer_El-Haj-Mahmoud]
if option pxe-system-type = 00:14 {
#filename
}
# 0x00 0x15,arm 32 uboot,[Joseph_Shifflett]
if option pxe-system-type = 00:15 {
#filename
}
# 0x00 0x16,arm 64 uboot,[Joseph_Shifflett]
if option pxe-system-type = 00:16 {
#filename
}
# 0x00 0x17,arm uboot 32 boot from http,[Joseph_Shifflett]
if option pxe-system-type = 00:17 {
#filename
}
# 0x00 0x18,arm uboot 64 boot from http,[Joseph_Shifflett]
if option pxe-system-type = 00:18 {
#filename
}
# 0x00 0x19,RISC-V 32-bit UEFI,[Dong_Wei]
if option pxe-system-type = 00:19 {
#filename
}
# 0x00 0x1a,RISC-V 32-bit UEFI boot from http,[Dong_Wei]
if option pxe-system-type = 00:1a {
#filename
}
# 0x00 0x1b,RISC-V 64-bit UEFI,[Dong_Wei]
if option pxe-system-type = 00:1b {
#filename
}
# 0x00 0x1c,RISC-V 64-bit UEFI boot from http,[Dong_Wei]
if option pxe-system-type = 00:1c {
#filename
}
# 0x00 0x1d,RISC-V 128-bit UEFI,[Dong_Wei]
if option pxe-system-type = 00:1d {
#filename
}
# 0x00 0x1e,RISC-V 128-bit UEFI boot from http,[Dong_Wei]
if option pxe-system-type = 00:1e {
#filename
}
# 0x00 0x1f,s390 Basic,[Hendrik_Brueckner]
if option pxe-system-type = 00:1f {
#filename
}
# 0x00 0x20,s390 Extended,[Hendrik_Brueckner]
if option pxe-system-type = 00:20 {
#filename
}
# 0x00 0x21,MIPS 32-bit UEFI,[Jiading_Zhang]
if option pxe-system-type = 00:21 {
#filename
}
# 0x00 0x22,MIPS 64-bit UEFI,[Jiading_Zhang]
if option pxe-system-type = 00:22 {
#filename
}
# 0x00 0x23,Sunway 32-bit UEFI,[Jiading_Zhang]
if option pxe-system-type = 00:23 {
#filename
}
# 0x00 0x24,Sunway 64-bit UEFI,[Jiading_Zhang]
if option pxe-system-type = 00:24 {
#filename
}
# 0x00 0x25,LoongArch 32-bit UEFI,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
if option pxe-system-type = 00:25 {
#filename
}
# 0x00 0x26,LoongArch 32-bit UEFI boot from http,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
if option pxe-system-type = 00:26 {
#filename
}
# 0x00 0x27,LoongArch 64-bit UEFI,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
if option pxe-system-type = 00:27 {
#filename
}
# 0x00 0x28,LoongArch 64-bit UEFI boot from http,[LI_Chao][https://loongson.github.io/LoongArch-Documentation/README-EN.html][https://github.com/loongson/LoongArch-Documentation]
if option pxe-system-type = 00:28 {
#filename
}
# 0x00 0x29,arm rpiboot,[Peter_Harper][https://www.raspberrypi.com/documentation/computers/remote-access.html#network-booting-using-ipv6]
if option pxe-system-type = 00:29 {
#filename
}
# 0x00 0x2a-0xff 0xff,Unassigned,
if option pxe-system-type = 00:ff {
#filename
}
标签:字符,00,每行,option,0x00,system,filename,sed,pxe
From: https://www.cnblogs.com/huangjinbang1996/p/18617741