About: Howto use find and sed to make a replace in multiple files   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : dbkwik.org associated with source dataset(s)

With the sed command and find command you can replace all instances of a word or multiple words in multiple files Examples * To replace "oldWord" with "newWord" in all the files *.c : find . -name "*.c" -exec sed -i "s/oldWord/newWord/g" '{}' \; * To replace multiple words in files : 1. * Edit a temporary file "replace.txt" 2. * Add the words you want to replace on a column 3. * Add the replacement words in the second column 4. * For example word1 replacement1 word2 replacement2 5. * To do the task, replace all the words from the first column with the equivalent from the second column in all the files *.c, Execute : counter=0;for f in `cat replace.txt`;do replace[counter]=$f;counter=$counter+1;done;counter2=0; for ((a=0; a <= $counter-1;

AttributesValues
rdfs:label
  • Howto use find and sed to make a replace in multiple files
rdfs:comment
  • With the sed command and find command you can replace all instances of a word or multiple words in multiple files Examples * To replace "oldWord" with "newWord" in all the files *.c : find . -name "*.c" -exec sed -i "s/oldWord/newWord/g" '{}' \; * To replace multiple words in files : 1. * Edit a temporary file "replace.txt" 2. * Add the words you want to replace on a column 3. * Add the replacement words in the second column 4. * For example word1 replacement1 word2 replacement2 5. * To do the task, replace all the words from the first column with the equivalent from the second column in all the files *.c, Execute : counter=0;for f in `cat replace.txt`;do replace[counter]=$f;counter=$counter+1;done;counter2=0; for ((a=0; a <= $counter-1;
dcterms:subject
abstract
  • With the sed command and find command you can replace all instances of a word or multiple words in multiple files Examples * To replace "oldWord" with "newWord" in all the files *.c : find . -name "*.c" -exec sed -i "s/oldWord/newWord/g" '{}' \; * To replace multiple words in files : 1. * Edit a temporary file "replace.txt" 2. * Add the words you want to replace on a column 3. * Add the replacement words in the second column 4. * For example word1 replacement1 word2 replacement2 5. * To do the task, replace all the words from the first column with the equivalent from the second column in all the files *.c, Execute : counter=0;for f in `cat replace.txt`;do replace[counter]=$f;counter=$counter+1;done;counter2=0; for ((a=0; a <= $counter-1; a=a+2)); do `sed -i "s/${replace[$a]}/${replace[$a+1]}/g" *.c` ;done; From HowTo Wiki, a Wikia wiki.
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software