Submitted by: Submitted by reeniilam
Views: 345
Words: 689
Pages: 3
Category: Science and Technology
Date Submitted: 11/10/2012 07:38 PM
Name: NILAM
Part 1
Create a subdirectory called homeworkfile
Create a file called animal.data under the homeworkfile subdirectory with the following data:
Aardvark
Giraffe
Bat
Elephant
Camel
Donkey
Fox
a) Translate all of the characters to characters into another file called animal2.
What is the command?
$ cat >animal2 animal.data
b) Sort and display the output from the animal2 file.
what is the command?
$sort animal2
c) Append the date to the end of the animal2 file.
what is the command?
$ date >> animal2
d) Create a file called showenvironment
The file must display the environment (env command).
The file must display your current home directory ; use the environment variable HOME.
Display a line saying The current date is thedate. (thedate comes from the command date. Use `` around a command that is executed in the shell script.
Ex: echo "The calendar for June is `cal 6 2004`."
what is the contents of the showenvironment file?
Part 2
Use the following text file for the homework problems:
#cat homework6file
northwest NW Mary Black 3.5
western WE Susan White 2.0
southern SO Mark Brown 4.0
southeast SE Jimmy Green 2.5
eastern EA Nancy White 3.0
northeast NE Rob Brown 2.5
north NO Marla Brown 3.0
central CT Ann Green 3.5
Type in the following "sed" commands.
List the output and explain what the command did for each of these commands:
1) sed '/north/p' homework6file
2) sed -n '/north/p' homework6file
3) sed '4d' homework6file
4) sed '4,$d' homework6file
5) sed '$d' homework6file
6) sed '/south/d' homework6file
7) sed 's/west/east/g' homework6file
8) sed -n 's/^west/east/p' homework6file
9) sed -n 's/Brown/Yellow/gp' homework6file
10) sed -n 's/\(Mar\)y/\1ian/p' homework6file
11) sed -n '/south/,/north/p' homework6file
12) sed -n '5,/^north/p' homework6file
13) sed '/east/,/west/s/$/--vacation--/' homework6file
14)...