Ho delle righe in un file di testo cosi'
<a href="PAROLE A CASO ANCHE SPAZI E CARATTERI">
Vorrei eliminare tutto quello che sta tra virgolette...
^(<a href=)[.]+(">)$ non funziona...
Ho delle righe in un file di testo cosi'
<a href="PAROLE A CASO ANCHE SPAZI E CARATTERI">
Vorrei eliminare tutto quello che sta tra virgolette...
^(<a href=)[.]+(">)$ non funziona...
[sergio@localhost tmp]$ cat pagina.html
<a href="PAROLE A CASO ANCHE SPAZI E CARATTERI">
[sergio@localhost tmp]$ cat pagina.html | sed 's/".*"/""/'
<a href="">
Slack? Smack!
Magari non usando espressioni regolari avevi già risolto, in ogni caso:
CiaoTEST="<a href=\"PAROLE A CASO ANCHE SPAZI E CARATTERI\">"
PRIMA=`echo $TEST | cut -d'"' -f1`
DOPO=`echo $TEST | cut -d'"' -f3`
echo "$PRIMA\"\"$DOPO"
"Dream on
Do you believe...all the things that you are seeing are true?
The Start's where the End's leading you
Do you believe...all's as twisted as one would perceive?
Seek the Answer and soon you'll believe"
Ah ecco a cosa serve sed!Originariamente inviato da Sergio Pedone
[sergio@localhost tmp]$ cat pagina.html
<a href="PAROLE A CASO ANCHE SPAZI E CARATTERI">
[sergio@localhost tmp]$ cat pagina.html | sed 's/".*"/""/'
<a href="">
"Dream on
Do you believe...all the things that you are seeing are true?
The Start's where the End's leading you
Do you believe...all's as twisted as one would perceive?
Seek the Answer and soon you'll believe"
Ciao Sym81!Originariamente inviato da Sym81
Magari non usando espressioni regolari avevi già risolto, in ogni caso:
Ciao
Il tuo esempio non fa una grinza quando si tratta di una sola
riga da elaborare. Bastano 2 righe e va in crisi:
La soluzione con sed è più indicata, secondo me.codice:[sergio@localhost tmp]$ cat pagina.html <a href="PAROLE A CASO ANCHE SPAZI E CARATTERI"> <a href="PAROLE A CASO ANCHE SPAZI E CARATTERI"> [sergio@localhost tmp]$ prima=`cat pagina.html | cut -d '"' -f1` [sergio@localhost tmp]$ dopo=`cat pagina.html | cut -d '"' -f3` [sergio@localhost tmp]$ echo "$prima\"\"$dopo" <a href= <a href=""> >
codice:[sergio@localhost tmp]$ cat pagina.html | sed 's/".*"/""/' <a href=""> <a href=""> [sergio@localhost tmp]$
Slack? Smack!
Sei un genio!Originariamente inviato da Sergio Pedone
[sergio@localhost tmp]$ cat pagina.html
<a href="PAROLE A CASO ANCHE SPAZI E CARATTERI">
[sergio@localhost tmp]$ cat pagina.html | sed 's/".*"/""/'
<a href="">
Senti ma posso usare le regex con SED??
Hai ragione, il tutto sarebbe da mettere in un for che gestisce riga per riga ma non ne vale assolutamente la pena. Sed gestisce tutto molto più semplicemente, peccato non l'abbia ancora studiato Ciao Sergio
"Dream on
Do you believe...all the things that you are seeing are true?
The Start's where the End's leading you
Do you believe...all's as twisted as one would perceive?
Seek the Answer and soon you'll believe"
Certamente.Originariamente inviato da Mutato
Senti ma posso usare le regex con SED??
Dai una lettura qui:
http://a2.swlibero.org/sed_introduzione.html
Ciao a tutti.
Slack? Smack!
Giusto per sfizio:
cat pagina.html | awk 'BEGIN { FS="\"" } { print $1"\"\""$3 }'
"Dream on
Do you believe...all the things that you are seeing are true?
The Start's where the End's leading you
Do you believe...all's as twisted as one would perceive?
Seek the Answer and soon you'll believe"
Ecco, mi hai subito scoperto...Originariamente inviato da Sym81
Giusto per sfizio:
non conosco awk!
Slack? Smack!