per esempio, ho fatto alcune prove con sed ma non ottengo i risultati che vorrei:
$ echo "[img]http://faidateoffgrid.altervista.org/forum/attachment/1372260472.jpg[/img] [img]Questo non deve cambiare[/img]" | sed '/faidateoffgrid/ { s|\(\[img\]http://faidateoffgrid.altervista.org/forum/attachment\)|\[img-local\]attachment|g ; s/\[\/img\]/\[\/img-local\]/g }' risultato: [img-local]attachment/1372260472.jpg[/img-local] [img]Questo non deve cambiare[/img-local] mi cambia entrambi i tag finali. come faccio a spiegare a sed, che deve cambiare i tag finali solo per quei pattern che rispettano determinate condizioni? ciao MAX 2013/7/15, MaX <[email protected]>: > ciao a tuttim > > 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] > questa è l'immagine 1 > http://energiaalternativa.forumcommunity.net/?t=54611292&p=382785730 > questa è l' URL 1 > [img]http://img.forumfree.net/html/emoticons/biggrin.gif[/img] questo > è lo smile 1 > [img]http://faidateoffgrid.altervista.org/forum/attachment/1373389058.jpg[/img] > questa è l'immagine 2 > > ---------------------------------------------------------------------------------------------------------------------- > > dopo un $ cat file | sed "qualchecosa" > > dovrebbe venire fuori cosí: > > --------------------------------------------------------------------------------------------------------------------- > > [img-local]attachment/1373389057.jpg[/img-local] questa è l'immagine 1 > http://energiaalternativa.forumcommunity.net/?t=54611292&p=382785730 URL 1 > [img]http://img.forumfree.net/html/emoticons/biggrin.gif[/img] questo > è lo smile 1 > [img-local]forum/attachment/1373389058.jpg[/img-local] questa è l'immagine > 2 > > ---------------------------------------------------------------------------------------------------------------------- > > > 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 > > naturalmente possono esserci più url con tag da cambiare per linea > mischiate con altre che non vanno modificate.... > > qualche idea? > > grazie in anticipo > > -- > ciao, > MaX > -- ciao, MaX -- 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/caeyavmt8al2pnjruzuw1i0jv6uixpojut5cu6zg4epgb4qn...@mail.gmail.com

