Unix Shell, Basic Computer Science

Write a shell script, change-lines, which will substitute a string for a replacement string for each occurance of the string in files specified.
The original file will be saved, with the same filename with the .keep extension unless the -n option is present.

You may use a temporary file for this script.

Remember the search string and or the replacement string can have special characters in them, so you must use proper quoting techniques.

The script will use following options:


the option -s "string" for the search strings
the option -r "string" for the replacement string
the -n option to prevent a backup file from being created
the -h option to print a usage statement and exit
The script will exit with an error status and print an error message:
if the -s option is not present.
if the -r option is not present.
if the string is not specified with the -s option
if the string is not specified with the -r option
if there are any other options specified
if there are no input files specified
if the input file cannot be read by the current process
if the input file cannot be written by the current process
if you cannot create the backup file.
Here is the usage statement for the script:
change-lines [-n] -s search string -r replace string files ...
-n do not backup the original file
-s search string the search for this string
-r replace string replace the search string with this string
-h print this message
Posted Date: 11/10/2012 9:10:45 PM | Location : United States







Related Discussions:- Unix Shell, Assignment Help, Ask Question on Unix Shell, Get Answer, Expert's Help, Unix Shell Discussions

Write discussion on Unix Shell
Your posts are moderated
Related Questions
Computer Storage: Computer systems include two types of digital information storage: internal storage, within the CPU, and the backing (back up) storage on external devices su

akrenda club has just opened their jym and pools services. They need a system that can keep record of total sales of each. The club has silver and gold members. The silver members

QUESTION (a) Draw an annotated diagram explaining how data is transmitted to web servers during a standard form submit event. (b) What in your opinion makes a bad web site?

The 21H function and the 22H function of the 21H interruption are the ones in charge of realizing the random readings and writings in that order. The random register number and the

The internet or the World Wide Web is the most familiar and popular example. These databases hold vast amounts of information, for example, on companies. By obtaining details in t

create a flowchart showing average score for the 3 quizzes assume that there are 3 sections each having 5 students the only valid number to be entered is 1-100 for the quizzes shou

if statement with explanation

Application-Specific Multiprocessors Although this book details a variety of similar architectures, it specializes in the design of such architectures in the perspective of par

#question.a tree has 0 off springs at each node. if it had a label L, what will be the maximum number of nodes that the tree can have. only an expression involving the number of no

ELECTRONIC EDUCATIONAL RESOURCES: In the present era, you can get access to a large number of electronic educational resources through the web. These resources may be on diffe