Sostituire stringhe in uno script bash con sed: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
| Line 14: | Line 14: | ||
== RIferimenti == | == RIferimenti == | ||
*[http://www.thegeekstuff.com/2009/10/unix-sed-tutorial-advanced-sed-substitution-examples/ Unix Sed Tutorial: Advanced Sed Substitution Examples] | |||
*[http://www.issociate.de/board/post/271626/String_substitution_in_file_names_using_shell_script.html String substitution in file names using shell script] | *[http://www.issociate.de/board/post/271626/String_substitution_in_file_names_using_shell_script.html String substitution in file names using shell script] | ||
Latest revision as of 14:28, 1 September 2010
Per sostituire un stringa in uno script bash, usare sed, lanciato come:
sed "s/originale/sostituito/"
Esempio:
#!/bin/bash OGGETTO="Io mi chiamo pippo e voglio essere chiamato pippo" echo Originale: $OGGETTO OGGETTO=$(echo OGGETTO | sed "s/pippo/pluto/g"" ) echo Sostituito: $OGGETTO