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

Convert string to super ascii, A string S is said to be "Super ASCII", if i...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''''''a''''''''-'''''''

SCM, advantages of E-SCM?

advantages of E-SCM?

Ida* search-artificial intelligence, IDA* Search-Artificial intelligence: ...

IDA* Search-Artificial intelligence: A* search is a sophisticated and successful search strategy. yet, a problem with A* search is that it might  keep every states in its memor

Explain briefly about das, Question 1 What is Content Addressable Storage?...

Question 1 What is Content Addressable Storage? Explain the elements of Content Addressable Storage Question 2 Explain briefly about DAS Question 3 Explain about N

Port in a computer, what is the need of a port in a computer?

what is the need of a port in a computer?

Software Exploration, I need to review 2 different softwares one is windows...

I need to review 2 different softwares one is windows based and the other is Linux Based. Please Ask for further details

Define jumps and loops , The unconditional jumps in a written program in a...

The unconditional jumps in a written program in assembler language are specified by the jmp instruction; a jump is to moves the flow of the execution of a program by sending the co

Explain the characteristics of vector processing, Question 1 Draw the bloc...

Question 1 Draw the block diagram of von Neumann Architecture and explain about its parts in brief Question 2 Draw the block diagram of Intel 8085 CPU organization and explai

Analogue and digital signals, Analogue and digital signals: Analogue (c...

Analogue and digital signals: Analogue (continuous) information is made available in virtually all aircraft equipment.  Figure 1 shows the analogue signal created by a variable

Data processing, Data Processing In any computer-based system, d...

Data Processing In any computer-based system, data storage and retrieval plays an important role. Data storage involves decision about the encoding of data, assignment o

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