2013/7/15 MaX <[email protected]>: > ciao a tuttim > Ciao!
> come sempre arrivo qui per chiedere aiuto con sed > > questa volta devo sostituire una serie di tag bbcode con altri, ma > solo con le immangini che sono in un determinato path > > immaginiamo di avere un file contenente: > --------------------------------------------------------------------------------------------------------------------- > > [img]http://faidateoffgrid.altervista.org/forum/attachment/1373389057.jpg[/img] [cut] > > praticamente il sed dovebbe cambiare solo i pattern conteneti > > [img]http://faidateoffgrid.altervista.org/forum/attachment > > in > > [img-local]attachment > > e fin li è facile > > ma poi SOLO in quelle stringhe deve cambiare anche il [/img] in > [/img-local], lasciando invariato tutto il resto di frasi, url e tag > [cut] Se ho capito bene: sed -r 's/\[img\].*(attachment[^\[]+)\[\/img\]/[img-local]\1[\/img-local]/g' Facendo una prova: alessandro@Lucie:~$ sed -r 's/\[img\].*(attachment[^\[]+)\[\/img\]/[img-local]\1[\/img-local]/g' <<< "[img]http://faidateoffgrid.altervista.org/forum/attachment/1373389057.jpg[/img]" [img-local]attachment/1373389057.jpg[/img-local] Ale -- Linux Registered User (http://counter.li.org) #378635 So this is how liberty dies...with thunderous applause. - Padmé Amidala -- Per REVOCARE l'iscrizione alla lista, inviare un email a [email protected] con oggetto "unsubscribe". Per problemi inviare un email in INGLESE a [email protected] To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: http://lists.debian.org/CAKKVCFZkVvWSzFy_T+-kbUMf0s5kkgyUoO4oAwo�[email protected]

