Find a file type and verify a line exists replace if value is different than expected -


i'm trying write batch file search directory file type. after find file name need read file verify line exists , overwrite line if different specific value.

if on unix/linux system, can this:

find . -name "*.txt" | xargs -l1 sed -i.bak 's/old contents/new contents/' 

this search current directory (and subdirectories) files end ".txt". each file finds, lines have "old contents". if finds such line, replace "new contents", , save old file previous name plus ".bak".

if on windows, install msys or cygwin, , same command.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -