The UNIX and Linux Forums  
Ciao e benvenuto da parte degli Stati Uniti al UNIX e Linux Forum! Grazie per la visita ed unirsi alla nostra Comunità Globale.

Go Back   UNIX e Linux Forum > Inizio Forum > Shell scripting e di programmazione
.
google unix.com



Shell scripting e di programmazione Pubblica domande su KSH, CSH, SH, Bash, Perl, PHP, sed, awk e da altri script di shell e linguaggi di scripting shell qui.

Più di UNIX e Linux Forum Argomenti potreste trovare utili
Filo Thread Starter Forum Risposte Ultimo Post
Shell Script awk di errore: "Errore di sintassi:` Split 'inatteso Herry UNIX for Dummies Domande & Risposte 2 03-17-2008 11:16 AM
errore in fase di esecuzione: St9bad_alloc - Ottenere questo errore durante l'utilizzo di alcuni conversione progr sathu_pec Shell scripting e di programmazione 1 01-21-2008 02:38 AM
Ho avuto come errore ... errore di sintassi sulla linea 1, teletype koti_rama UNIX e avanzata per utenti esperti 2 07-07-2007 07:35 PM
errore di lettura sezioni di errore durante l'installazione doelman SUN Solaris 2 02-05-2007 12:21 PM
Errore: Errore interno di sistema: Impossibile inizializzare il file di output standard firkus UNIX for Dummies Domande & Risposte 2 10-25-2005 03:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Cerca in questo Thread Rate Thread Modalità di visualizzazione
  #1 (permalink)  
Old 04-28-2008
f_o_555 f_o_555 is offline
Utente Registrato
  
 

Iscriviti Data: novembre 2007
Interventi: 62
sed errore

in una shell bash ho il seguente

S00 \u003d "BLOCK-NOMI / ELM1 / SAUT0 / FIT00 PER ELMT, CAMPIONE, FIT"
S01 \u003d "BLOCK-NOMI / ELM1 / SAUT0 / FIT01 PER ELMT, CAMPIONE, FIT"

sed "s / '$ S00' / '$ S00' / g" pb206.cnt> tmp

sed commplains e dice
sed: Espressione-e # 1, char 29: Sconosciuto opzione `s'

Can anybody help?
Grazie!
  #2 (permalink)  
Old 04-28-2008
Shivdatta Shivdatta is offline
Utente Registrato
  
 

Iscriviti Data: marzo 2006
Interventi: 73
Prova questo
Codice:
sed 's/$S00/$S01/g' pb206.cnt > tmp
invece di
Codice:
sed "s/'$S00'/'$S00'/g" pb206.cnt > tmp
  #3 (permalink)  
Old 04-28-2008
f_o_555 f_o_555 is offline
Utente Registrato
  
 

Iscriviti Data: novembre 2007
Interventi: 62
Grazie Shivdatta, non si lamentano più, ma non sostituisce la stringa!
  #4 (permalink)  
Old 04-28-2008
epoca era is offline Forum Advisor  
Herder di Inutile Gatti (Su sabbatico)
  
 

Iscriviti Data: marzo 2008
Ubicazione: / ci / è / solo / bin / sh
Interventi: 3.652
Si sostituisce una stringa con la stessa stringa, quindi è del tutto possibile che la sostituzione, ma non c'è modo di dire.

Che cosa si aspetta il risultato di essere come?
  #5 (permalink)  
Old 04-28-2008
f_o_555 f_o_555 is offline
Utente Registrato
  
 

Iscriviti Data: novembre 2007
Interventi: 62
Naturalmente le stringhe sono diverse:
qui è lo script

S00 \u003d "BLOCK-NOMI / ELM1 / SAUT0 / FIT00"
S01 \u003d "BLOCK-NOMI / ELM1 / SAUT0 / FIT01"
S02 \u003d "BLOCK-NOMI / ELM1 / SAUT0 / FIT02"
S03 \u003d "BLOCK-NOMI / ELM1 / SAUT0 / FIT03"

sed 's / $ S00 / S01 $ / g' pb206.cnt> tmp1
sed 's / $ S00 / S02 $ / g' pb206.cnt> tmp2
sed 's / $ S00 / S03 $ / g' pb206.cnt> tmp3

ma tmp1, tmp2 e tmp3 sono le stesse pb206.cnt (che contiene S00)
  #6 (permalink)  
Old 04-28-2008
f_o_555 f_o_555 is offline
Utente Registrato
  
 

Iscriviti Data: novembre 2007
Interventi: 62
Ho effettivamente a sostituire l'intera stringa S00 con S01
  #7 (permalink)  
Old 04-28-2008
Shivdatta Shivdatta is offline
Utente Registrato
  
 

Iscriviti Data: marzo 2006
Interventi: 73
Se nel caso in cui e stanno cercando di sostituire FIT00 da FIT01 quindi se questo aiuta

sed 's / \ (.* \) FIT00 \ (.* \) / \ 1FIT01 \ 2 / g' il nome del file
Closed Thread

Segnalibri

Thread Tools Cerca in questo Thread
Cerca in questo Thread:

Ricerca Avanzata
Modalità di visualizzazione Vota questo thread
Vota questo thread:

Distacco regolamento
Tu non può post nuovo thread
Tu non può inviare una risposta
Tu non può postare allegati
Tu non può modificare i tuoi post

BB codice è Su
Smilies sono Su
[IMG] codice Su
Codice HTML è Chiuso
Trackbacks sono Su
Pingbacks sono Su
Refbacks sono Su




Tutti gli orari sono GMT -4. La data di oggi è 08:06 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Traduzioni Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
UNIX e Linux Forum Content Copyright © 1993-2009. Tutti i diritti Reserved.Ad di gestione da RedTyger

Contenuti pertinenti URL da vBSEO 3.2.0