from the file "classfile.dat" bellow do the following commands :
a. Display the contents of the file sorted by last name. Ignore leading white space
. b. Display lines, with line numbers, for Computer Science majors.
c. Display lines for students whose e-mail addresses end with .edu.
d. Display all lines but show only the last name and GPA, sorted by GPA.
2. Search your home directory and all sub-directories, and display pathnames of all C++ program files. Terminate your command line with 2> /dev/null in order to ignore error messages.
6. Write a command to output the inode/filename pairs for all the files in /export/home/public/rajni/esit200, sorted by inode number.
=====================================================
classfile.dat:
John Doe ECE 3.54 [email protected] 111.222.3333
James Davis ECE 3.71 [email protected] 111.222.1111
Al Davis CS 2.63 [email protected] 111.222.2222
Ahmad Rashid MBA 3.74 [email protected] 111.222.4444
Sam Chu ECE 3.68 [email protected] 111.222.5555
Arun Roy SS 3.06 [email protected] 111.222.8888
Rick Marsh CS 2.34 [email protected] 111.222.6666
James Adam CS 2.77 [email protected] 111.222.7777
Art Pohm ECE 4.00 [email protected] 111.222.9999
John Clark ECE 2.68 [email protected] 111.111.5555
Nabeel Ali EE 3.56 [email protected] 111.111.8888
Tom Nelson ECE 3.81 [email protected] 111.111.6666
Pat King SS 2.77 [email protected] 111.111.7777
Jake Zulu CS 3.00 [email protected] 111.111.9999
John Lee EE 2.64 [email protected] 111.111.2222
Sunil Raj ECE 3.36 [email protected] 111.111.3333
Charles Right EECS 3.31 [email protected] 111.111.4444
Diane Rover ECE 3.87 [email protected] 111.111.5555
Aziz Inan EECS 3.75 [email protected] 111.111.1111
Lu John CS 3.06 [email protected] 111.333.1111
Lee Chow EE 3.74 [email protected] 111.333.2222
Adam Giles SS 2.54 [email protected] 111.333.3333
Andy John EECS 3.98 [email protected] 111.333.4444
a. Display the contents of the file sorted by last name. Ignore leading white space
cat classfile.dat|sort -u -k2
****-u for field wise sort by sort command, and k2 means 2nd field.
b. Display lines, with line numbers, for Computer Science majors.
cat classfile.dat|grep -nw "CS
****grep is for search, -n for line numbers,w for word wise search
c. Display lines for students whose e-mail addresses end with .edu.
cat classfile.dat|grep "\.edu"
****grep for search, and \ is for .
d. Display all lines but show only the last name and GPA, sorted by GPA.
cat classfile.dat|sort -u -k4|tr -s " "|cut -d " " -f 2,4
****tr is used for squeeze characters and cut is used for extract field wise. -d in cut is for delimeter.
2. Search your home directory and all sub-directories, and display pathnames of all C++ program files. Terminate your command line with 2> /dev/null in order to ignore error messages.
find /root -name "*.cpp" 2>/dev/null
****find command is used for search files with path
6. Write a command to output the inode/filename pairs for all the files in /export/home/public/rajni/esit200, sorted by inode number.
ls -i /export/home/public/rajni/esit200|sort -u -k1
****ls -i displays filename with inode number.
from the file "classfile.dat" bellow do the following commands : a. Display the contents of the...