Question

In: Computer Science

PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name...

PLEASE USE LINUX/UNIX

1.Use either pico, vi, or cat to create the following file and name it as “mysedfile”:

Name Class1 Class2 Class3

Tom 92 94 88

Nancy 91 85 95

Lisa 99 77 96

Jerry 84 98 90

2. Please use sed command(s) to complete the following tasks.

    1. display Tom’s record.
    1. display Lisa’s record.
    1. display both Tom’s and Lisa’s records.
    1. remove the blank line(s) from “mysedfile.”
    1. replace all the digits with *.

Solutions

Expert Solution

All the question were executed on Linux Unbuntu.

Let me know if you have any doubts or need any modifications.

mysedfile is in desktop.

mysedfile

display Tom’s record.

sed -n '/Tom/p' mysedfile

SED command in UNIX is stands for stream editor and it can perform lot’s of function on file like, searching, find and replace, insertion or deletion.

The -n option asks sed to not display the regex or patten unless explicitly asked to do so. Try removing -n option and you will understand the difference:

display Lisa’s record.

sed -n '/Lisa/p' mysedfile

display both Tom’s and Lisa’s records.

sed -n '/Tom/p' mysedfile && sed -n '/Tom/p' mysedfile

I used && (or operator) to print both the lines

remove the blank line(s) from “mysedfile.”

sed -r '/^\s*$/d' mysedfile

replace all the digits with *.

sed 's/[0-9]/*/g' mysedfile

[0-9] will match all digits, and replace every single one with *

If you have any doubts, leave a comment below before rating. I'll be happy to assist you further.

Do UPVOTE this as I have put a lot of EFFORT in answering this question. It really helps me.


Related Solutions

Use Vi text editor or ATOM to create a bash script file. Use the file name...
Use Vi text editor or ATOM to create a bash script file. Use the file name ayaan.sh. The script when ran it will execute the following commands all at once as script. Test your script file make sure it works. Here is the list of actions the script will do: It will create the following directory structure data2/new2/mondaynews off your home directory. inside the mondaynews, create 4 files sports.txt, baseball.txt, file1.txt and file2.txt. Make sure file1.txt and file2.txt are hidden...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would type to... Quit the vi editor and save any changes? 7. C language source files, by convention, have the suffix ".c". The associated "header" files have the suffix ".h". What is the command to perform the following task: List all the C source and C header files in the current directory. [Hidden files may remain hidden.] 8. C language source files, by convention, have...
Linux Directories, File Properties, and the File System in C Understanding Unix/Linux Programming Your version of...
Linux Directories, File Properties, and the File System in C Understanding Unix/Linux Programming Your version of mv command The mv command is more than just a wrapper around the rename system call. Write a version of mv that accepts two argument. The first argument must be the name of a file, and the second argument may be the name of a file or the name of a directory. If the destination is the name of a directory, then mv moves...
Create by using Linux server • Create a file name it foo.txt • Remove all permissions...
Create by using Linux server • Create a file name it foo.txt • Remove all permissions from foo.txt • What happen if you try to read the file? • Change foo.txt permission to read and write only for owner • Change foo.txt permission to read for group • Change foo.txt permission to read and write everyone
please use linux or unix to complete, and include pictures of the output. Modify the code...
please use linux or unix to complete, and include pictures of the output. Modify the code below to implement the program that will sum up 1000 numbers using 5 threads. 1st thread will sum up numbers from 1-200 2nd thread will sum up numbers from 201 - 400 ... 5th thread will sum up numbers from 801 - 1000 Make main thread wait for other threads to finish execution and sum up all the results. Display the total to the...
Linux Question: Describe how you created above file and its contents in VI. a) Bash/VI commands:...
Linux Question: Describe how you created above file and its contents in VI. a) Bash/VI commands: 20pts; b) Non-brute-force solution: 10pts). Note: Brute-force solution means that entering characters one by one Install JDK 1.8 by the following command: $ sudo dnf –y install java-1.8.0-openjdk-devel.x86_64 Use VI to create a file “YourFirstNameHomework.java” (e.g., “MollyHomework.java”) and add the following contents into it. (grading details: file name format:10 pts, a screenshot of the file content in the VI environment: 10pts, paragraphs: 10pts, empty...
Linux regular expressions: file name: lab3test.txt Create regular expressions that meet the following criteria. You may...
Linux regular expressions: file name: lab3test.txt Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Match any lines that contain a phone number with the format 222-222-2222.
linux Regular expressions file name: lab3test.txt Create regular expressions that meet the following criteria. You may...
linux Regular expressions file name: lab3test.txt Create regular expressions that meet the following criteria. You may use grep or egrep to answer these questions. 1.Display all lines where the employee’s age is greater than 40 years old. Again, don’t think of this as a number, think of it as a series of characters.
unix/Linux Create a tar command using the man command and the link referred to in To...
unix/Linux Create a tar command using the man command and the link referred to in To Practice and Explore: Text File Utilities #9. Preliminaries Use the man pages to learn more about tar Review the links referred to in To Practice and Explore: Text File Utilities #9 to see examples of using tar command Perform Use tar "to stuff" three files and then "unstuff" them into a new directory. Include the -v option. Task ll to show the original 3...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all its contents. Write a shell script to validate password strength. Here are a few assumptions for the password string.   Length – a minimum of 8 characters. • Contain alphabets , numbers , and @ # $ % & * symbols. • Include both the small and capital case letters. give a prompt of Y or N to try another password and displays an error...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT