Quote:
Originally Posted by coolplanet
Sed command is to do within a single file only. I have hundreds of files which has this same ip inside. Can i use something like this find "xxx.xxx.xx" -exec rm {} \; ?
|
I can't create an example right now, but:
1. Use "find" to create a list of target files.
2. Apply the list to a "sed" filter that reads the original file and places the result in a temp file.
3. Copy the temp file over the original.
4. Continue looping over file paths.
But don't try to sed from a particular file directly to the same file:
sed "regex" < file > file
This is a bad mistake. It sometimes works while you are testing, then when you turn your back, it starts eating files. Always use a temp file for the output of the pipe.