Page 200 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 200

Network Operating Systems-I




                    notes



                                      Note     The same scheme of creating backup files is used by the Emacs editor.

                                   sedutility

                                   The sed utility is a stream editor that can be used for different file editing purposes when used
                                   as a filter. The most common task for software development purposes is the use of sed to search
                                   and replace text in source code files.
                                   This utility reads one or more text files, makes editing changes according to a script of editing
                                   commands, and writes the results to standard output. The script is obtained from either the script
                                   operand string or a combination of the option-arguments from the -e script and -f script_file
                                   options.
                                   The sed utility supports the XBD specification, Utility Syntax Guidelines, except that the order of
                                   presentation of the -e and -f options is significant.

                                   The following options are supported:
                                   -e script: Add the editing commands specified by the script option-argument to the end of the
                                   script of editing commands. The script option-argument has the same properties as the script
                                   operand, described in the OPERANDS section.
                                   -f script_file: Add the editing commands in the file script_file to the end of the script.
                                   -n: Suppress the default output (in which each line, after it is examined for editing, is written to
                                   standard output). Only lines explicitly selected for output will be written.

                                   Multiple -e and -f options may be specified. All commands are added to the script in the order
                                   specified, regardless of their origin.
                                   The following operands are supported:

                                   file: A pathname of a file whose contents will be read and edited. If multiple file operands are
                                   specified, the named files will be read in the order specified and the concatenation will be edited.
                                   If no file operands are specified, the standard input will be used.
                                   script: A string to be used as the script of editing commands. The application must not present a
                                   script that violates the restrictions of a text file except that the final character need not be a new-
                                   line character.
                                   stdin: The standard input will be used only if no file operands are specified.
                                   input files: The input files must be text files. The script_files named by the -f option will consist
                                   of editing commands, one per line.
                                   Diff utility: The diff utility is another useful tool that developers may need. It is used to find out
                                   the differences between two files. If you are using CVS, differences between different versions
                                   of a file in the CVS repository can be found using the cvs (cvs diff) command as well. However,
                                   if you want to find out the difference between two files that are not in the CVS repository, the
                                   diff utility may be quite handy. One common use may be to find out the difference between the
                                   working copy and the backup copy of a source code file. This will enable you to find out what
                                   changes have been made in the working copy of the file. The output of the diff utility follows
                                   similar rules to those used in the CVS diff command. It displays the differences between two files,
                                   or each corresponding file in two directories.

                                   Each set of differences is called a “diff” or “patch”. For files that are identical, diff normally
                                   produces no output; for binary (non-text) files, diff normally reports only that they are different.
                                   Syntax is diff [options] from-file to-file


          194                              LoveLy professionaL university
   195   196   197   198   199   200   201   202   203   204   205