Create a shell script to manipulate passwd file in directory

Assignment Help Operating System
Reference no: EM131299760

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.

Reference no: EM131299760

Questions Cloud

How does a revocable living trust affect estate taxes : Value of Estate. Why is it important to calculate the value of your estate periodically? 10. Estate Planning. Beyond the will, what does estate planning involve?
Java class library collections framework : What support exists for linked lists in the Java Class Library Collections Framework? Do you think this support is easy to understand and use? Why or why not?
Permanent funds are classified as : During the current year, the earnings from this gift were $24,000. The earnings from this gift should generally be considered revenue to which of the following funds?
Explain way that business organization use mobile technology : Next, determine at least two ways that business organizations use mobile technologies to become more efficient, productive, and profitable. Support your response.
Create a shell script to manipulate passwd file in directory : Create a shell script (lab2_q2.sh) to manipulate passwd file in /etc directory to automate some tasks. Filter list1.txt file containing the word "ball". Display on the screen and also save to the file ball.txt.
What is appropriate entry when the city receives interest : Previously Atomic City had issued bonds with a face value of $10 million to construct a new city hall. Because the money will not be needed for several months, the city invested the bond proceeds in U.S. Government securities. Assume that the city..
Keyboard device stored keystrokes in a buffer : Suppose that the keyboard device stored keystrokes in a buffer until it was full then sent the entire buffer for processing. What would be some adverse consequences? (Two or three sentences should be adequate to answer this question)
Personal loan officer at first national bank : Abagail Nelson, a 25-year-old personal loan officer at First National Bank- How much will she have accumulated when she turns 65 if she invests in equities and earns 8 percent on average?
What is an irrevocable living trust : Contributions. How can contributions to charitable organizations help in estate planning?

Reviews

Write a Review

Operating System Questions & Answers

  Question about affiliate programs

Many companies are using affiliate programs to drive traffic to their Web sites. explain what an affiliate program is and how it works.

  Identifying wireless network architectures

Some of the local hospital's administrators are questioning privacy of patients' data with wireless transmission. Discuss and determine the merits of their concerns.

  Requirements model for aims project

Need help in finalizing the requirements model for Airlines Information Management System (AIMS) project. The requirements model require to include use case diagrams for the entire AIM system.

  What lessons do the ancient greeks teach us

WHAT LESSONS DO THE ANCIENT GREEKS TEACH US ABOUT THE ROLE OF PERSONAL CHARACTER IN A GOOD NATIONAL LEADER?

  Virtual machine design

In a virtual machine design where guest operating systems are independent virtual machines supported by a host operating system, what factors are involved in choosing the host operating system?

  Single machine with total capacity

Suppose that there is a single machine with total capacity of 23 units of time, and that one gets partial credit for partially processing a task, so that processing a task of value Vi for time t

  Write a script for user maintenance

You now need to write a script for user maintenance. Write a script that will perform the following tasks: Prompt the system administrator for all valid input parameters

  Formulate the above in terms of a linear programming problem

Formulate the above in terms of a Linear Programming problem Solve this linear program graphically. Determine the quantity of each type of toaster that will maximise the maximum profit

  Designing and coding

Prepare a database with a table called tblNames and tbl Login. The tbl Names table should have the following columns.

  Explaining cpu midway through the disk-service routine

CPU with interrupt-driven I/O is busy servicing  disk request. While CPU is midway through the disk-service routine, another I/O interrupt occurs. What occurs next?

  What is the overall big-o of this algorithm?

What is the overall Big-O of this algorithm?

  Individual operating systems

Discuss and explain the statement: "Global communication has developed to such a degree that the true operating system is the net itself, where the individual operating systems are just its nodes".

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd