1.Dispaly only first field of each line from /etc/ passwd file
The first field of each line from /etc/passwd file can be displayed by using different methods such as cut, awk etc.
Using cut
cut -d':' -f1 /etc/passwd
awk -F : '{print $1}' /etc/passwd
2. Last 50-100 days modified files
find is used in linux for searching/finding the files with desired attributes
find / -mtime +50 –mtime -100
Display only first filed of each line from /etc/passwd file. Find last 50-100 days modified files.
Exercise 1: Write a shell script that loops through the /etc/passwd file one line at a time. Prepend each line with a line number followed by a colon and then a space. Example output: 1: root:x:0:0:root:/root:/bin/bash 2: daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin 3: bin:x:2:2:bin:/bin:/usr/sbin/nologin 4: sys:x:3:3:sys:/dev:/usr/sbin/nologin Exercise 2: Write a shell script that asks the user for the number of lines they would like to display from the /etc/passwd file and display those lines. Example output: How many lines of /etc/passwd would you like...
Create a shell script to find and copy the files of temp1 (only which are older than 90 days and are not modified in last 90 days) to temp2 and after copying the files, remove those same files from temp1?
using lubuntu ce the following activities on your Linux virtual machine. Then complete estions. Write a script file which when executed will perform the following: First display today's date in dd.mm.YYYY format (e.g. 20.04.2019). Ask user to enter a name to create a directory. Create a directory by the given directory name above. . . Ask user to enter a name to create a file. Copy the file /etc/passwd to the given filename above inside the newly created directory Copy...
I need to write a C++ program using DEV C++ that reads and prints a joke and its punch line from two different files. The first file contains a joke, but not its punchline. The second file has the punch line as its last line, preceded by “ garbage.” The main function of the program should open the two files and then call twofunctions, passing each one the file it needs. The first function should read and display each line...
Develop a java program using multithreading in which each thread reads data from two separate input text files and display each line of data from each file on the Console alternatively such that one line from the first input file is printed and then one line from the other input file is printed etc.
Create a data file with 1000 lines. Each line in the file consists of an employee’s first name, last name, position rank, and salary. The employee’s first name and last name for the i- th line are FirstName and LastName. The position rank is randomly generated as a clerk, supervisor, manager, director. The salary is randomly generated as a number with two digits after the decimal point. The Salary for a clerk should be in the range from 40,000 to...
C++ developing involves ut from a file a person's first name, last name, phone number and birth a menu driven database application. You need to 4) This program accept as input ogram will be menu driven with the following options: 1) Find a person's information 2) Add a person to the database 3) Edit a person's information 4) Display all records to the screen 5) Quit Option 1 allows the user to enter a name after which you will search...
In either Java or Python 3, write a program that simulates a deterministic FSM. It will read from two input files. The first is a file describing an FSM The first line contains the alphabet as a series of characters separated by a single space - The second line contains the number of states as an integer k 2 1; states will be numbered 0,1,..., k -1. The start state is always state O The third line contains a series...
In either Java or Python 3, write a program that simulates a deterministic FSM. It will read from two input files. The first is a file describing an FSM The first line contains the alphabet as a series of characters separated by a single space - The second line contains the number of states as an integer k 2 1; states will be numbered 0,1,..., k -1. The start state is always state O The third line contains a series...
C++ code The assignment has two input files: • LSStandard.txt • LSTest.txt The LSStandard.txt file contains integer values against which we are searching. There will be no more than 100 of these. The LSTest.txt file contains a set of numbers that we are trying to locate within the standard data set. There will be no more than 50 of these. Read both files into two separate arrays. Your program should then close both input files. All subsequent processing will be...