Bash : supprimer caracteres repetitif debut chaine (trim ?)
Résolu/Fermé
A voir également:
- Bash : supprimer caracteres repetitif debut chaine (trim ?)
- Retour à la ligne bash ✓ - Forum Shell
- Bash path - Astuces et Solutions
- Bash permission non accordée - Forum Shell
- Bash arguments - Astuces et Solutions
- Bingo bash free - Télécharger - Divers Jeux
3 réponses
mamiemando
Messages postés
33029
Date d'inscription
jeudi 12 mai 2005
Statut
Modérateur
Dernière intervention
28 mars 2024
7 736
28 janv. 2013 à 10:17
28 janv. 2013 à 10:17
(mando@silk) (~) $ echo "abababaefgthhyyyyyyj45645" | sed "s/^\(ab\)*\(.*\)/\2/" aefgthhyyyyyyj45645
Ceci dit il doit y avoir mieux car j'ai utilisé l'opérateur \( \) pour le motif répété là où ( ) devrait suffire, mais il reste un exemplaire du truc à éliminer si j'utilise les parenthèses normales je ne sais pas pourquoi...
Bonne chance
dubcek
Messages postés
18718
Date d'inscription
lundi 15 janvier 2007
Statut
Contributeur
Dernière intervention
22 mars 2024
5 616
28 janv. 2013 à 13:04
28 janv. 2013 à 13:04
hello
sed Solaris ne connait pas l'option -r d'où les \ sans le -r
sed Solaris ne connait pas l'option -r d'où les \ sans le -r
$ cat a1 abababaefgthhyyyyyyj45645 a12a12codird aaaaaaasortiraaaaa $ sed 's/^\(ab\|a12\|aa\)*//' a1 aefgthhyyyyyyj45645 codird asortiraaaaa $ sed -r 's/^(ab|a12|aa)*//' a1 aefgthhyyyyyyj45645 codird asortiraaaaa $