J'aimerais créer un script qui permet (avec un paramètre) de supprimer une partie d'un fichier de conf du packet lirc. Ce logiciel permet d'enregistrer des télécommandes physiques.
par exemple j'ai mon fichier lircd.conf avec deux télécommandes enregistrés comme ceci:
#
# this is a space encoded remote control from AIWA
# you need at least lirc-0.5.4 compiled with the LONG_IR_CODE option
# to use this config file
#
# contributed by Jan (Oblivion@mail.dma.be)
#
# brand: AIWA
# model: RC-950LE
# supported devices: AIWA-
# Amplifier
# Tuner
# Equaliser
# CD
# Tape1
# Tape2
#
begin remote
name AIWA
bits 42
flags SPACE_ENC|CONST_LENGTH
eps 60
aeps 0
header 9175 4432
one 625 1650
zero 625 500
ptrail 625
plead 0
foot 0 0
repeat 9175 4432
pre_data_bits 0
pre_data 0x0
post_data_bits 0
post_data 0x0
pre 0 0
post 0 0
gap 108765
repeat_bit 0
begin codes
AMP_CD 0x000000781C3F20DF
AMP_PHONO 0x000000781C3F609F
AMP_TAPE1 0x000000781C3F807F
AMP_TAPE2 0x000000781C3F40BF
AMP_TUNER 0x000000781C3FC03F
AMP_VIDEO/AUX 0x000000781C3FE01F
AMP_VOL_DOWN 0x000000781C3F48B7
AMP_VOL_UP 0x000000781C3F8877
CD_0 0x000001B8123F50AF
CD_1 0x000001B8123F807F
CD_2 0x000001B8123F40BF
CD_3 0x000001B8123FC03F
CD_4 0x000001B8123F20DF
CD_5 0x000001B8123FA05F
CD_6 0x000001B8123F609F
CD_7 0x000001B8123FE01F
CD_8 0x000001B8123F10EF
CD_9 0x000001B8123F906F
CD_+10 0x000001B8123FD02F
CD_NEXT 0x000001B8123F18E7
CD_PAUSE 0x000001B8123FE817
CD_PLAY 0x000001B8123FA857
CD_PREV 0x000001B8123F9867
CD_PRGM 0x000001B8123FB04F
CD_STOP 0x000001B8123F58A7
TAPE1_REW 0x00000338063F40BF
TAPE1_FFWD 0x00000338063F807F
TAPE1_PAUSE 0x00000338063FE01F
TAPE1_PLAY 0x00000338063FA05F
TAPE1_PLAYREV 0x00000338063F609F
TAPE1_REC 0x00000338063F20DF
TAPE1_RECMUTE 0x00000338063FC03F
TAPE1_STOP 0x00000338063F50AF
TAPE2_REW 0x00000338063F48B7
TAPE2_FFWD 0x00000338063F8877
TAPE2_PAUSE 0x00000338063FE817
TAPE2_PLAY 0x00000338063FA857
TAPE2_PLAYREV 0x00000338063F6897
TAPE2_REC 0x00000338063F28D7
TAPE2_RECMUTE 0x00000338063FC837
TAPE2_STOP 0x00000338063F58A7
GEQ_DOWN 0x000003D8013F08F7
GEQ_LEFT 0x000003D8013F708F
GEQ_MANUAL 0x000003D8013F48B7
GEQ_POWER 0x000003D8013FD02F
GEQ_PGM 0x000003D8013F8877
GEQ_RIGHT 0x000003D8013FB04F
GEQ_UP 0x000003D8013FF00F
TUN_1 0x000002780C3F807F
TUN_2 0x000002780C3F40BF
TUN_3 0x000002780C3FC03F
TUN_4 0x000002780C3F20DF
TUN_5 0x000002780C3FA05F
TUN_6 0x000002780C3F609F
TUN_7 0x000002780C3FE01F
TUN_8 0x000002780C3F10EF
TUN_9 0x000002780C3F906F
TUN_10 0x000002780C3F50AF
TUN_11 0x000002780C3FD02F
TUN_12 0x000002780C3F30CF
TUN_DISPLAY 0x000002780C3F42BD
TUN_FM 0x000002780C3FA857
TUN_FM_MODE 0x000002780C3FC837
TUN_LW 0x000002780C3F28D7
TUN_MW 0x000002780C3F6897
TUN_POWER 0x000002780C3F00FF
TUN_SLEEP 0x000002780C3FA25D
end codes
end remote
#
# this config file was automatically generated
# using lirc-0.8.6(devinput) on Thu Mar 25 14:33:38 2010
#
# contributed by
#
# brand: PiPi
# model no. of remote control: PiPi PC Remote Control
# devices being controlled by this remote: Ubuntu, PulseAudio, etc
#
begin remote
name PiPiPC
bits 16
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 16
pre_data 0x8001
gap 132799
toggle_bit_mask 0x0
begin codes
KEY_POWER 0x0074
KEY_RADIO 0x001d 0x001e
KEY_TV 0x001d 0x0014
KEY_DVD 0x001d 0x0031
KEY_SOUND 0x001d 0x0032
BTN_THUMB 0x001d 0x0017
KEY_VIDEO 0x001d 0x0012
KEY_MENU 0x001d 0x002f
KEY_UP 0x0067
KEY_MUTE 0x0042
KEY_VOLUMEUP 0x0073
KEY_LEFT 0x0069
KEY_ENTER 0x001c
KEY_RIGHT 0x006a
KEY_VOLUMEDOWN 0x0072
KEY_BACK 0x000e
KEY_DOWN 0x006c
KEY_TITLE 0x003b
KEY_CHANNELUP 0x0068
KEY_1 0x0002
KEY_2 0x0003
KEY_3 0x0004
KEY_CHANNELDOWN 0x006d
KEY_4 0x0005
KEY_5 0x0006
KEY_6 0x0007
KEY_RECORD 0x001d 0x0013
KEY_7 0x0008
KEY_8 0x0009
KEY_9 0x000a
KEY_AGAIN 0x002a 0x0013
KEY_0 0x000b
KEY_PLAY 0x002a 0x0019
KEY_PAUSE 0x001d 0x0019
KEY_STOP 0x001d 0x001f
KEY_REWIND 0x002a 0x0020
KEY_FASTFORWARD 0x002a 0x0021
KEY_PREVIOUS 0x001d 0x0030
KEY_NEXT 0x001d 0x0021
end codes
end remote
On vois bien la première télécommande nomé AIWA et la deuxième nomé PiPiPC.
Je voudrais maintenant supprimer la télécommande AIWA de ce fichier de conf, c'est a dire du "#" jusqu'au "end remote" uniquement de la télécommande AIWA, comment faire....
Toute la config de la télécommande AIWA doit être supprimé et pas seulement la chaine de caractère AIWA....
Pourrais-tu m'expliquer un peu plus ton expression régulière? j'ai un peu de mal a comprendre
la vérité se cache dans les eviers
Comment supprimer du texte dans un fichier de conf
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
Validez la réponse utile « Un problème clairement exposé est à moitié résolu. » Pas de MP technique