Version imprimable du sujet

Cliquez ici pour voir ce sujet dans son format original

Forums MacBidouille _ Vos Bidouilles _ Trouver-remplacer délicat [résolu]

Écrit par : losto 11 Dec 2018, 10:04

Bonjour.
Dans une liste de plus de 10 000 noms, je souhaite remplacer le tiret entre nom de l'artiste et morceau par un tiret long. J'utilise Renamer qui peut faire ça en un clin d'œil. Mais, problème, je ne souhaite pas modifier un éventuel tiret dans le nom du morceau (exemples entourés de rouge). Donc, en gros, modifier le premier tiret, pas l'éventuel deuxième ni le très rarement troisième.
Une solution (avec Renamer ou autre)?

[attachment=57912:Capture_...09.48.10.png]

Écrit par : baron 11 Dec 2018, 15:01

Il faudrait te tourner vers les expressions régulières (avec une commande GREP) mais je ne peux pas te guider là-dedans.

L'idée serait de chercher une chaîne de caractères avec un tiret, suivie d'une autre chaîne de caractères quelconques terminée par un retour à la ligne…

Écrit par : NABLABLA 13 Dec 2018, 11:46

Je t'invite à regarder du côté de NameChanger https://mrrsoftware.com

Il propose entre autre : "Replace first occurence with"... ce qui semble correspondre à ton attente !

Je l'ai testé, ça fonctionne !

Écrit par : losto 13 Dec 2018, 13:48

Bah, c'est tout bête... Renamer, dont je suis satisfait, ne propose pas cette option (à laquelle je n'avais pas pensé d'ailleurs, sinon j'aurais cherché l'app ad hoc), à moins peut-être de se pencher sur les possibilités "cachées" et de faire un chouïa de programmation. Alors va pour NameChanger, et merci pour le tuyau!

Écrit par : losto 25 Dec 2018, 13:05

Pour compléter ce post, je vous mets ci-dessous la réponse à ma question posée au développeur. C'est en anglais mais pour la manip ça importe peu. Tout de même plus compliqué qu'avec NameChanger...

Hi Leo,

Thank you for your email!

I'm not in front of a mac Desktop to test this, but the below should work:

Renamer: Regular Expression
Apply to: Name only
Pattern: ([^-]*)-(.*)
Replace: $1 $2

Example input:
It's A Kind of Magic - Queen -- Greatest Hits II.mp3

Example output:
It's A Kind of Magic Queen -- Greatest Hits II.mp3

Best regards
Philipp

On Tue, 11 Dec 2018 at 10:16, Leo S*** <L***@free.fr> wrote:

Hi. 466/5000
In a list of names with a name (often in several words), a normal dash and a title (that is a name and a title separated by a normal dash), I want to replace the normal dash by a long dash. Renamer must do this without any problem. But in the title, it happens that there is another normal dash (or two, very rarely), and these dashes, I do not want to change them. So, basically, the goal is to replace the first dash found in the name, but not the other one or the others. Can Renamer do that?

Écrit par : dtb06 24 Jan 2019, 18:54

Avec Excel j'utiliserais "substitue" comme cela :
https://www.noelshack.com/2019-04-4-1548352405-inkedsans-titre-li.jpg


Propulsé par Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)