Unix Shell, Basic Computer Science

Assignment Help:
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

Related Discussions:- Unix Shell

Syntax - programming language, Syntax: Syntax provides the structure a...

Syntax: Syntax provides the structure and how to formulate the phrase or sentence w.r.t grammar of the language. It tells us about which composition is allowed from the charac

Java program, To find the minimum number of shelves in the loading process ...

To find the minimum number of shelves in the loading process in cars

Input - output services, Input/Output Services:   Every operating syst...

Input/Output Services:   Every operating system, large or small, provides input/output services for each device in the system. The operating system includes I/O device driver

Software development, requirement analysis and specification for online vot...

requirement analysis and specification for online voting

Ms word, what is ms words in parts ms words in life?

what is ms words in parts ms words in life?

What is atm cell, Header contains routing and error control information Pay...

Header contains routing and error control information Payload carries the actual user information, either voice, data or video

Summery, This is an article and I want great synopsis for the article

This is an article and I want great synopsis for the article

Assembly, Design and develop a program to calculate the sum of an integer n...

Design and develop a program to calculate the sum of an integer number using MIPS assembly language.

Html, a program to create htmlpage

a program to create htmlpage

Designing computer based system-systems life cycle approach, Systems Life C...

Systems Life Cycle Approach Systems Analysis and Design follows a life cycle for development, as shown below. Brief discussion on this approach is given here: Figure

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd