Originally Posted by frieza
well first of all you dont use sed to search a file, that would be the job of grep
and second.. sed by default dumps to stdout, i havnt't used sed enough to know the exact command to get it to actually EDIT the file but man sed would be a starting point if you havnt already
otherwise >> file2, move file1 to an archive rename file2 to file1
I wouldn't use sed for your scenario
sed -i filename
get's it to do an "inline" edit, however that doesn't deal with your calculation requirement.
How big is the datafile that you need to work on?
For small files (1000 lines or less) Ghostdog74's suggestion would be the easiest way to go.
Are you planning to test for unique names in the file?