$Id: sed.php 298 2009-12-30 01:53:00Z gjb $
sed
sed is a stream editor. This tool allows you to change the contents of a file, without opening the file, but its power goes far beyond that.
Basic syntax:
sed -i 'backup_extension' 'command' filename
For example, if you had a file test.txt:
Hello World!In the first example, we will change the word 'World' to 'User':
sed -i '.bak' 's/World/User/' test.txtThis will give us the
test.txt file containing Hello User!, and a backup file test.txt.bak.