Customer Service Chat
Get quote & make Payment
Unix Shell, Basic Computer Science
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
Posted Date: 11/10/2012 9:10:45 PM | Location : United States
Ask an Expert
Unix Shell, Assignment Help, Ask Question on Unix Shell, Get Answer, Expert's Help, Unix Shell Discussions
Write discussion on Unix Shell
Your posts are moderated
Write your message here..
Network management system , Shared documents system assignment
Shared documents system assignment
Cloud computing, report
COMPUTER, What is a computer??
What is a computer??
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
Operating systems, Operating Systems: The operating system is the soft...
Operating Systems: The operating system is the software that mediates between the applications programs and a level of instructions nearer to the machine's operations. In othe
Sequential reading in fcb files, Earlier than anything we must describe the...
Earlier than anything we must describe the file transfer area or DTA. With the intention of sequentially read we use the 14H function of the 21Hinterruption.The register to be read
Python Strings and Python Lists, Python Strings: Strings in Python are rec...
Python Strings: Strings in Python are recognized as an adjacent set of characters in among quotation marks. Python permits for either pairs of single or double quotes. Subsets of s
Define z-transform of sequence x[n], QUESTION (a) Define z-transform o...
QUESTION (a) Define z-transform of sequence x[n]. (b) A causal LTI system has impulse response h[n], for which the z-transform is H(z) = (1+z -1
Operating system, Does Process Manager in Operating System know the depende...
Does Process Manager in Operating System know the dependency order that Process A depends on Process B?
Kirchhoff’s law, A car battery is of 12 V. Eight dry cells of 1.5 V each ...
A car battery is of 12 V. Eight dry cells of 1.5 V each connected in series can give 12 V. But such cells are not used in starting a car. Why?
Accounting Assignment Help
Economics Assignment Help
Finance Assignment Help
Statistics Assignment Help
Physics Assignment Help
Chemistry Assignment Help
Math Assignment Help
Biology Assignment Help
English Assignment Help
Management Assignment Help
Engineering Assignment Help
Programming Assignment Help
Computer Science Assignment Help
Why Us ?
~24x7 hrs Support
~Quality of Work
~Time on Delivery
~Privacy of Work
Human Resource Management
Literature Review Writing Help
Terms & Conditions
Copyright by ExpertsMind IT Educational Pvt. Ltd.