Question

Give a single pipeline, using the head and the tail commands to: (in linux) select lines 5 to 10 from a file select se...

  1. Give a single pipeline, using the head and the tail commands to: (in linux)
    1. select lines 5 to 10 from a file
    2. select second-to-last line (i.e. the line before the last line) from a file
0 0
Add a comment Improve this question Transcribed image text
Answer #1

command for creating a file on current directory => touch the_file.txt

command for writing lines into the file => echo "line_1" >> the_file.txt

command for reading from lines 5 to 10 => sed -n '5,10p' the_file.txt

command for reading the last line from the file => sed -n '$p' the_file.txt

Add a comment
Know the answer?
Add Answer to:
Give a single pipeline, using the head and the tail commands to: (in linux) select lines 5 to 10 from a file select se...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Post-Lab 2: GNU and UNIX commands Keywords: • Sort • head tail • Pipe (D •...

    Post-Lab 2: GNU and UNIX commands Keywords: • Sort • head tail • Pipe (D • Redirection ) • alias • Wildcards • Metacharcters . sed utility Find • tar 1. Create a directory called Dirl and if the creation was successful, change the current working directory to be Dirl. 2. Extract lines 3-5 from a file, first using head to get the first 5 lines then tail to get the last 2 lines . With pipes . With redirection...

  • How do I select lines 5-10 of a file in two ways by using head and...

    How do I select lines 5-10 of a file in two ways by using head and tail?

  • In a linux command line Give AWK commands for accomplishing each of the following: Print the...

    In a linux command line Give AWK commands for accomplishing each of the following: Print the 2nd last field (the field directly before the last field) of each line from a file named 'last.txt' Assume you have a file called 'names' that contains a list of people, one person per line. Also, assume that on each line the 3rd field on that line contains the age of the person. Some of the people do not have an age listed, and...

  • Using Linux commands grep 3.0.3 Questions: Using patterns wtih grep Provide the grep commands for the...

    Using Linux commands grep 3.0.3 Questions: Using patterns wtih grep Provide the grep commands for the following searches in the file /usr/share/common-licenses/GPL-3 1. All lines that contain words that begin with a capital letter. 3 2. All text of any length that is a parenthetical statement (i.e., in paren- thesis). 3. Any line in the file that begins with a capital letter and ends with a period. 4. Any line in the file that contains the strings "GPL" or "General...

  • LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check...

    LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check the output) Display the command(s) used to do the following: create an empty file called history by using just a redirection operator. Verify and show. Show/verify all results (i.e., all commands and their corresponding outputs). Wait 1 minute or more and then display the command(s) used to do the following: change the timestamp on the history file you just created. Verify/display the change. Show/verify...

  • Round 1: sequence.c This program should read and execute a list of commands from stdin. Each comm...

    Round 1: sequence.c This program should read and execute a list of commands from stdin. Each command and its arguments (if any) will appear on a separate line. For example, if the file "cmdfile" contains the lines: whoami cal 4 2019 echo The time is: date then running 1 /sequence< cmdfile should output your username, a calendar of the month of April, the string "The time is:", and the current date/time, to standard output. Suggested approach: first, make sure you...

  • 12.8 GPA reports using files Prompt the user by "Enter name of input file: " for...

    12.8 GPA reports using files Prompt the user by "Enter name of input file: " for the name of an input file and open that file for reading. The two input files for the tests are already at the zyBooks site.They each have a list of student names with the course they have taken, of the form Jacobs, Anthony ECS10 4 B- ECS20 4 C+ ANS17 3 A ANS49H 2 D Wilson, Elaine ECS10 4 B+ ECS20 4 C+ ANS17...

  • Completion is a screenshot of the batch file showing all of the steps to create the file system s...

    Completion is a screenshot of the batch file showing all of the steps to create the file system shown below. Instructions Create a batch file clifilesystem.cmd using Notepad which performs the following steps to create the file system shown below. Also use a proper comment for each step before the command. Proof your work. Finally submit the clifilesystem.cmd file in Blackboard Figure 1. The clijfilesystem.cmd file system Work from Desktop unless using an absolute path Desktop NOS110 OS Labs Homework...

  • Write a C++ program that reads text from a file and encrypts the file by adding...

    Write a C++ program that reads text from a file and encrypts the file by adding 6 to the ASCII value of each character. See section 5.11 in Starting out with C++ for information on reading and writing to text files. Your program should: 1. Read the provided plain.txt file one line at a time. Because this file has spaces, use getline (see section 3.8). 2. Change each character of the string by adding 6 to it. 3. Write the...

  • Lab #10 C++ Write a C++ program that reads text from a file and encrypts the...

    Lab #10 C++ Write a C++ program that reads text from a file and encrypts the file by adding an encryption factor (EF) to the ASCII value of each character. The encryption factor is 1 for the first line and increases by 1 for each line up to 4 and then starts over at 1. So, for the 4 th line the EF is 4, for the 5th line it is 1, for the 10th line it is 2. In...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT