conditional branch t. An instruction b followed by a valid label name will move processing to the command following that label. The t instruction will only do so if there was a successful substitution since the previous t (or the start of the program, in case of the first t encountered). Additionally, the { instruction starts a subseqence of commands (upto the matching }); in most cases, it will be conditioned by an address pattern. sed used as a filter Under Unix, sed is often used as a filter in a pipeline: $ generateData | sed 's/x/y/g' That is, a program such as "generateData" generates data, and then sed makes the small change of replacing x with y. For example: $ echo xyz xyz | sed 's/x/y/g' yyz yyz File-based sed scripts It is often useful to put several sed commands, one command per line, into a script file such as subst.sed, and then use the -f option to run the commands (such as s/x/y/g) from the file: sed -f subst.sed inputFileName > outputFileName Any number of commands may be placed into the script file, and using a script file also avoids problems with shell escaping or substitutions. Such a script file may be made directly executable from the command line by prepending it with a "shebang line" containing the sed command and assigning the executable permission to the file. For example, a file subst.sed can be created with contents: #!/bin/sed -f s/x/y/g The file may then be made executable by the current user with the chmod command:chmod u+x subst.sedThe file may then be executed directly from the command line: subst.sed inputFileName > outputFileName In-place editing The -i option, introduced in GNU sed, allows in-place editing of files (actually, a temporary output file is created in the background, and then the original file is replaced by the temporary file). For example: sed -i 's/abc/def/' fileName Examples Hello, world! example # convert input text stream to "Hello, world!" s/.*/Hello, world!/ q This "Hello, world!" script is in a file (e.g., script.txt) and invoked with sed -f script.txt inputFileName, where "inputFileName" is the input text file. The script changes "inputFileName" line #1 to "Hello, world!" and then quits, printing the result before sed exits. Any input lines past line #1 are not read, and not printed. So the sole output is "Hello, world!". The example emphasizes many key characteristics of sed: Typical