The -i.bak option will make a backup copy called file.txt.bak in case your regex goes disastrously wrong.
In reply to Re: File handling by friedo in thread File handling by editi