variable dernier caractere texte

variable dernier caractere texte - Shell/Batch - Programmation

Marsh Posté le 10-04-2009 à 15:38:12    

Bonjour,
 
J' aimerais faire une recherche dans un texte du dernier caractère ( chiffre )
et afficher une boite de dialogue si ce caractere n' est pas le chiffre 2.
Voici le fichier TXT qui est actualisé chaque minute
 
Operator0002.log:627342 31.Mar 08:48:22.187  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=1  
Operator0002.log:627515 31.Mar 09:03:14.078  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=2  
Operator0002.log:629052 01.Apr 10:27:12.625  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=1  
Operator0002.log:629084 01.Apr 10:35:13.968  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=2  
Operator0002.log:631388 07.Apr 08:29:51.132  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=1  
Operator0002.log:631490 07.Apr 08:45:47.007  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=2  
Operator0002.log:633047 08.Apr 08:29:15.945  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=1  
Operator0002.log:633126 08.Apr 08:44:59.460  --MParamDialog: PARAMETER changed ,'Conv. corr. handling', id=0xc426, value=2  
 
Merci pour votre aide
 
Philou

Reply

Marsh Posté le 10-04-2009 à 15:38:12   

Reply

Marsh Posté le 10-04-2009 à 16:15:15    

Quel shell ? Windows ? Unix ?
 
Sous Unix, je ferais

x=`tail -1 fichier.txt|grep -v "value=2"`

Puis test si x est vide ou non, etc.

Reply

Marsh Posté le 10-04-2009 à 16:27:59    

Non, malheureusement, c'est sous windows. Concernant le message à envoyer, un NET SEND devrait faire l' affaire, mais la recherche du dernier caractère du fichier texte me pose probleme. Un petit Batch devrait y arriver, avec l'instruction FOR et TOKEN, je crois, mais le coince. Mais merci tt de mm d' avoir répondu si vite

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed