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

Mis, #questionexplain strategic mis categories in detail with illustration....

#questionexplain strategic mis categories in detail with illustration..

Java Assignment, Hi? are you conversant with Java that is J2SE 6 coz i have...

Hi? are you conversant with Java that is J2SE 6 coz i have assignments on this area?

College management system project, E-R diagram and details for college mana...

E-R diagram and details for college management system

Science, Ask question #Minimum 100 words accepted/

Ask question #Minimum 100 words accepted/

Cisc, two characteristics og CISC architecture?

two characteristics og CISC architecture?

Telecommunications network, Telecommunications network: "A telecommuni...

Telecommunications network: "A telecommunications network, at its simplest, may be regarded as comprising a transmission network, an arrangement of transmission paths and swit

What is Router. Explain Network Router, A router is a device which has play...

A router is a device which has played an important role in the development and existence of the Internet. Routers are designed to transmit data from other network users to specific

Fundamental of algorithm, exchanging the two variables: problem,algorithm d...

exchanging the two variables: problem,algorithm development,discription

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