Apr 10, 2007 #1 loloman Technical User Oct 30, 2002 16 FR I want to find a string in multiple files and substitute it with shell command grep value *.log ....
Apr 10, 2007 1 #2 feherke Programmer Aug 5, 2002 9,541 RO Hi Code: find . -type f -exec sed -i 's/string/grep value *.log ..../g' '{}' \; This is exactly what you asked for. If you mean "substitute it with shell command[red]'s output[/red]", then you have to reformulate your question. Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Code: find . -type f -exec sed -i 's/string/grep value *.log ..../g' '{}' \; This is exactly what you asked for. If you mean "substitute it with shell command[red]'s output[/red]", then you have to reformulate your question. Feherke. http://rootshell.be/~feherke/
Apr 10, 2007 Thread starter #3 loloman Technical User Oct 30, 2002 16 FR Thank you I want to replace "Aborted" by "Vu" in files *.log It's ok with this command find . -type f -name '*.log' -exec sed -i 's/Aborted/Vu/g' '{}' \; Upvote 0 Downvote
Thank you I want to replace "Aborted" by "Vu" in files *.log It's ok with this command find . -type f -name '*.log' -exec sed -i 's/Aborted/Vu/g' '{}' \;
Apr 10, 2007 #4 Ogzilal MIS Oct 9, 2003 280 FR Hi, Usually, log files are intented to relate what was happened during process execution. It's a bad idea to replace manually things in log files. Upvote 0 Downvote
Hi, Usually, log files are intented to relate what was happened during process execution. It's a bad idea to replace manually things in log files.
Apr 10, 2007 #5 feherke Programmer Aug 5, 2002 9,541 RO Hi Note that [tt]sed[/tt] creates a new file when used with the -i option. So be sure no application logs in those files while you execute that command. Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Note that [tt]sed[/tt] creates a new file when used with the -i option. So be sure no application logs in those files while you execute that command. Feherke. http://rootshell.be/~feherke/