INSTRUCTIONS: 1. Type a single sed command-line that will remove a...

  1. Home
  2. Homework Library
  3. Computer Science
  4. Linux
  5. INSTRUCTIONS: 1. Type a single sed command-line that will remove a...


1. Type a single sed command-line that will remove all leading spaces (and only leading spaces) from each line in the file "book-with-margin" and store the results in the file "book-without-margin". You don't know exactly how many leading spaces there may be on each line: (note that the fill-in answer sheet is further below)
2. In a [ ps -ef ] listing, all processes currently running on the system are reported, one per line. Most of the system processes (as opposed the user processes) are either owned by the "root" user (as indicated in the output) or are daemons (and don't indicate any associated TTY device in the output... reporting only "?" in place of a valid device name). Type a single command-line, piping the output of ps (with the -ef options) through sed to filter out any lines either beginning with "root" or containing a " ? " (question mark surrounded by spaces). This will show all the processes owned by regular (logged in) users. Note that the pattern "root" must only be detected at the beginning of a line:
3. Type a sed command-line that will show only the lines in the file "BK" that begin with the word "Zossima" but without displaying that word in the actual output (i.e, sed should delete that word from the beginning of those lines before actually printing them). The result is that only the lines that had originally contained "Zossima" at their beginning are output, but only displaying the remainder of those lines in the output (not the leading "Zossima" that was originally there). Don't delete the entire line or show any other lines in the output:
4. Type an awk command-line that will display only the owner and name of every file in the current working directory (hint: owner is the 3rd and name is the 9th column in a long listing). Be sure to include the syntax that generates the file listing in your single line pipe:
5. Type a command-line pipe using sed and awk that displays all the file names in the current working directory without their extentions.

1. Removing leadins spaces:
2. Listing only non-daemon processes:
3. Lines formerly beginning with the name Zossima:
4. Owner and Name of every file:
5. Listing of files without their extensions:

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

2. Listing only non-daemon processes:
[ps -ef | sed '{/root| ? /!...

By purchasing this solution you'll be able to access the following files:

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Linux Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats