Create a shell script lab2q2sh to manipulate passwd file in


1. Write a shell script (lab2_q1.sh) to do the following:

a. Create list1.txt (use echo command) as:
Football
Basketball
Skates
Soccer ball
Golf ball
Shoes

b. Create list2.txt (use echo command) as:
Football
Basketball
Skates
Soccer ball
Tennis ball
Runners

c. Compare list1.txt with list2.txt and find the differences

d. Combine list1.txt and list2.txt one after the other, then sortthe datain reverse order and save it aslist_sort.txt

e. Join the two files list1.txt with list2.txt column wise

f. Filter list1.txt file containing the word "ball". Display on the screen and also save to the file ball.txt.

g. Count the number of lines which are unique in list_sort.txt file.

Paste the shell script and output in the solution document

2. Create a shell script (lab2_q2.sh) to manipulate passwd file in /etc directory to automate some tasks

a. Copy /etc/passwd file to your home directory as password.txtfile

b. Display the first 3 lines and last 5 lines of password.txt file to pass.txt file (use appropriate commands)

c. Copy login id, user name and home directory of all users whose name contains ben or dan (upper or lowercase) from password.txt (or /etc/passwd) , sort the data by user name and save to a file called users.txt

d. Ask the user to enter the username to search in password.txt file and store in a variable called userName.

e. Search password.txt whether the user entered in (d) exists or not. (i.e.) display the userid and home directory only (it should allow both uppercase and lowercase name)

f. Count the number of users whose name does not start with [a-c] in password.txt

g. Replace pass.txt to display the data separated by , and not :and also convert from lowercase to uppercase, save to a file called pass_new.txt and also display on the screen

h. Ask the user to enter the filename, permission value (absolute) and store in variables. Use these variables to set the permission of the file specified.

i. Display the date as Mon-dd-YYYY from the date command (use appropriate commands)

Paste the shell script and output in the solution document

3. Create a shell script (lab2_q3.sh) to do the following:

a. Count the number of files in your folder

b. Find the highest file size in your home directory

c. Create a variable called myshell which stores the current shell

d. Display the logon time, username and ip address of the users who logged on the machine and store in a file called who.log

e. Create two variables named the first variable first with the value 50 and second variable named second with the value 30. Create a third variable which adds first and second. Display the third variable.

f. Assign today's date to the variable named today using command substitution

g. Create a variable called list_files which consists of all filenames only in your directory (use command substitution)

Paste the shell script and output in the solution document.

Request for Solution File

Ask an Expert for Answer!!
Operating System: Create a shell script lab2q2sh to manipulate passwd file in
Reference No:- TGS01702460

Expected delivery within 24 Hours