COMSC 171 Dvc Diablo Valley College Unix and Linux Questions

Question Description

I’m stuck on a Programming question and need an explanation.

  1. Write a single vi OR emacs command to do each of the following. Answer all parts for the same editor: [6]

    @. name the editor

    1. copy (region between mark and cursor)
    2. cut (region between mark and cursor)
    3. paste (last cut or copy)
    4. save and exit
    5. search for a string
    6. set a mark
  2. Explain why each of the following IP v4 addresses cannot be assigned to a network interface directly connected to the public Internet: [4]
  3. Write an extended regular expression to match each of the following: [4]
    1. One underscore or letter (uppercase or lowercase) followed by zero or more underscores, letters, or numerals
    2. A number >= 0 and < 10 with or without one or more digits following a decimal point
  4. Write a bash command to assign each of the following to the scaler variable Var: [6]
    1. the first character of the variable Str
    2. the first element of the array variable Arr
    3. the remainder from dividing the integer value of the variable I by the integer value of the variable J
  5. Write a bash command to assign to the array variable Arr the elements of the array variable Brr sorted in numeric order. [2]
  6. Write a UNIX command to do output each of the following from text input: [8]
    1. All lines, arranged with the 4th characters in reverse dictionary order
    2. Only the first sentence (ending with a period) from each line.
    3. All lines, with every space changed to an underscore
    4. Only lines which do not contain any spaces