#!/bin/bash string1='abc'; string2='123'; directory='test_directory'; for file in $(grep -lr $string1 $directory); do echo $file; cp $file /tmp/temporal_file; sed s/${string1}/${string2}/ /tmp/temporal_file > $file; rm -rf /tmp/temporal_file; done;
sábado, 19 de octubre de 2013
A bash script for replacing a string in every file of a directory
It replaces all occurrences of the search string with the replacement string in every file of a specified directory:
Suscribirse a:
Entradas (Atom)