Write a function called substring that uses the leftmatch and rightmatch functions developed in Exercises 3 and 4 to remove a pattern from the left and right side of a value. It should take three arguments as shown:
$ substring /usr/ /usr/spool/uucppublic /uucppublic
spool
$ substring s. s.main.c .c
main
$ substring s. s.main.c .o Only left match
main.c
$ substring x. s.main.c .o No matches
s.main.c
$
# substring leftpat value rightpat
#
# remove leftpat, then rightpat from value
leftpat=$1
value=$2
rightpat=$3
newvalue=$(sh leftmatch $leftpat $value)
sh rightmatch $newvalue $rightpat
You might also like to view...
Timestamping is
(a) used to provide proof that a message has been sent. (b) performed by a time stamping agency. (c) the process of binding a time and date to a digital document. (d) All of the above.
What are the two sets in Dijkstra's algorithm?
a. The data structure used to process each vertex b. A hash table data structure to store vertex and edge information c. Two linked list data structures d. Two stacks that hold the vertices and edges
Slide Sorter view allows the user to apply formatting to multiple slides at one time
Indicate whether the statement is true or false
The dump/restore utility is limited to a maximum of how many different incremental backups?
A. seven B. eight C. nine D. ten