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

  Why thread belonging to same process affected by page fault

Other user user threads belonging to the same process also be affected by the page fault (i.e., would they also have to wait for the faulting page to be brought into memory?) Explain.

  Problem on demand-page system

Describe in general how the system is being used and explain the effect on the above measurement (CPU utilization) if the following occurred

  Discuss the differences between windows and mac os

Discuss the differences between Windows and Mac OS. You may discuss any recent versions of either operating system. Compare and contrast the two, and provide arguments for choosing a PC with Windows or a Mac with Mac OS.

  How to install and how to use it

How to install linux. How to use linux. How to install linux on virtual machine. Commands of linux. How to execute task in linux.

  Benefits of leasing vs purchasing hardware and software

Your responses to the questions and statements must be supported with 2-3 academic sources in addition to the textbook, such as case studies and empirical studies.

  Comparison of wireless lan and lan

Assume your local hospital has decided to extend their offices to another department of the building where it is difficult to have cables installed.

  Identify various hardware components and network topologies

Describe protocols at the different layers of the OSI model and explain their functionality

  Create a wbs for the b&b problem

Create a WBS for the B&B problem Feasibility Analysis Discuss Web-based options with Tom and Sue. Determine if Web-based or stand-alone system.

  Give a brief definition of sequential file processing.

Develop an example to illustrate your definition. (The example does not have to be as elaborate. Just a record with a simple explanation)

  What is the subnet mask

Give the network number, local broadcast and the usable IP address ranges for the 5000th, 50000th & 150000th networks

  Write a report outlining methods of acquiring image in linux

Write a 300-500 words report outlining two methods of acquiring an image in Linux. Student can use Kali and Ubuntu Linux virtual machine (VM) images provided in this subject's lab.

  Oracle datatypes for the attributes

Choose Oracle datatypes for the following attributes from a normalized relation including:

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