Sep 08 2005

Profile Image of sand
sand

SED ERE ROTTO

Posted at 12:27 pm under niente a senso

Chi ha scritto sed probabilmente aveva GRAVI PROBLEMI NELLA COMPRENSIONE DELLA REALTA’ SOCIALE.

Regular expressions match entire strings, not just individual lines, but a newline character is matched by \n in a sed RE; a newline character is not allowed in an RE. Also note that \n cannot be used to match a newline character at the end of an arbitrary input line; newline characters appear in the pattern space as a result of the N editing command.

No perche’ io non capisco.
“Le espressioni regolari matchano stringhe intere, non solo linee individuali, ma un carattere di newline e’ matchato da \n in una regexp di sed; un carattere di newline non e’ permesso in una regexp. Per di piu’ sappi che \n non puo’ essere usato per matchare un carattere di newline alla fine di una arbitraria linea di input; i caratteri di newline appaiono nel pattern space come risultato del comando di editing N.”

AH ALLORA HO CAPITO TUTTO, PERO’ NON POSSO FARE
s/\n\+/\n/

CIOE’ COMPRIMERE X LINEE VUOTE IN UNA SOLA. GRAZIE.
E PIOVE.

One response so far

One Response to “SED ERE ROTTO”

  1. sandon 08 Sep 2005 at 1:22 pm 1

    Al momento l’unica soluzione sembra VIM:
    :%s/^\n\+/\r/

    Trasforma 1+X righe vuote in una singola riga vuota.

Comments RSS

Leave a Reply