Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.regexp > #140
| From | Olivier Miakinen <om+news@miakinen.net> |
|---|---|
| Newsgroups | fr.comp.lang.regexp |
| Subject | Re: HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 |
| Date | 2021-08-22 00:49 +0200 |
| Organization | There's no cabale |
| Message-ID | <sfrvu1$1j1b$1@cabale.usenet-fr.net> (permalink) |
| References | <e9o2iglp322joqd0e6hcv3ccle8qle74ge@4ax.com> |
Bonjour, Le 21/08/2021 à 22:37, Mitchell199 a écrit : > SVP, mon français n'est pas tres bien, mais je vais essayer (avec un > peu de l'aide d'un traducteur en ligne): Merci de faire cet effort. > > Si j'ai des fichiers nommés comme ceci: > > 16h25m22s- nom > 16h25m24s- nom > 16h25m26s- nom > > Comment puis-je les renommer comme ceci en utilisant regex: > > 16h25.1- nom > 16h25.2- nom > 16h25.3- nom Je crois bien que c'est la première fois que je vais répondre « c'est impossible ». En tout cas avec seulement les regexp. Mais c'est possible en utilisant d'autres outils. Par exemple, si tu es sur Linux, la commande 'cat -n' ajoute un numéro de ligne que l'on peut ensuite utiliser. Exemple (que je copie comme une citation pour que les lignes ne soient pas coupées) : > $ ls -1 > '16h25m22s- nom' > '16h25m24s- nom' > '16h25m26s- nom' > > $ ls | cat -n | sed 's/ *\([0-9]*\)\t*\(..h..\)\(m..s\)\(.*\)/mv "\2\3\4" "\2.\1\4"/' > renomme > > $ cat renomme > mv "16h25m22s- nom" "16h25.1- nom" > mv "16h25m24s- nom" "16h25.2- nom" > mv "16h25m26s- nom" "16h25.3- nom" > > $ sh renomme > > $ ls -1 > '16h25.1- nom' > '16h25.2- nom' > '16h25.3- nom' > renomme -- Olivier Miakinen
Back to fr.comp.lang.regexp | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 Mitchell199 <NoSpamAtAll@JunksvilleNo.com> - 2021-08-21 16:37 -0400
Re: HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 Olivier Miakinen <om+news@miakinen.net> - 2021-08-22 00:49 +0200
Re: HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 Mitchell199 <NoSpamAtAll@JunksvilleNo.com> - 2021-08-23 10:16 -0400
Re: HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 Otomatic <otomatic@oto.invalid> - 2021-08-23 19:06 +0200
Re: HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 Mitchell199 <NoSpamAtAll@JunksvilleNo.com> - 2021-08-24 07:03 -0400
Re: HHhMMmSSs -> HHhMM.1, HHhMM.2 ... (ex 16h25m22s, 16h25m24s, 16h25m26s -> 16h25.1, 16h25.2, 16h25.3 Olivier Miakinen <om+news@miakinen.net> - 2021-08-24 12:45 +0200
csiph-web