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

Multiple Statement Groups as Suites, Sets of individual statements making u...

Sets of individual statements making up a single code block are known as suites in Python. Composite or complex statements for example if, def while and class are those which neces

Data buses, Data buses: The availability of reliable digital semi-condu...

Data buses: The availability of reliable digital semi-conductor technology has enabled the inter-communication task between different equipment to be significantly improved. P

Array, An array A is said to be special if all its elements are same. Given...

An array A is said to be special if all its elements are same. Given an array, your task is to convert the array to special array by performing some operations. The allowed operati

C program , write a c program for below question

write a c program for below question

Discuss on browsers for cloud computing, Question 1 Discuss on "Platform a...

Question 1 Discuss on "Platform as a Service" Question 2 Write a note on Accounting Services Question 3 Explain the different Software clients Question 4 D

Block matching algorithm, I am using block matching algorithm to get the mo...

I am using block matching algorithm to get the motion vectors, now, how can I get the depth map/depth value from the motion vectors?

Artificial intelligence-search in problem solving, Search in Problem Solvin...

Search in Problem Solving If Artificial Intelligence can notify the extra sciences about something, it is about trouble solving and, in exacting, how to search for solutions to

COMPUTER, DUNIYA KA AISA KONSA KOMPUTER HAI. JISME KEYBORD, MOUSE NAHI HAI?...

DUNIYA KA AISA KONSA KOMPUTER HAI. JISME KEYBORD, MOUSE NAHI HAI?

Describe Priority Scheduling algorithm of operating system?, Priority Sched...

Priority Scheduling • The fundamental idea is straightforward: each process is assigned a priority, and priority is permitted to run. Equal-Priority processes are scheduled in FCF

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