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

Discuss the objectives of query processing, Question 1 Differentiate betwe...

Question 1 Differentiate between PL/SQL functions and procedures Question 2 Draw the diagram of logical structure of oracle database and explain it in brief Question 3 D

Soft computing, Defination of Propositionl logic Predicate logic genertic a...

Defination of Propositionl logic Predicate logic genertic algorithm Hybrid system Optimization Fuzzy system rules Fuzzy system application

SQL 2008 Server Management Studio, 4. Provide a list of productid’s, the n...

4. Provide a list of productid’s, the name of the vendor and their credit rating. The results should be ordered by last name and then by credit rating. Write out the SQL that wo

Configuration of a pc, Configuration of a PC: Generally, when you thin...

Configuration of a PC: Generally, when you think of purchasing a Computer, you first try to exactly know what will be the hardware components such as processor, memory etc. of

SOFTWARE, main task of sofware developper

main task of sofware developper

Visual Basic 2012, Can someone help me write a code for force = mass * acce...

Can someone help me write a code for force = mass * acceleration.

Eeprom, Ask queswhat is the advanages of eeprom?

Ask queswhat is the advanages of eeprom?

COMPUTER ORGANIZATION, Ask questio2. Define interrupt n #Minimum 100 words ...

Ask questio2. Define interrupt n #Minimum 100 words accepted#

Programs, creating programs in scheme

creating programs in scheme

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