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...

  • Using a Linux command-line interpreter, show the screenshots for executing the following commands: (1) display the...

    Using a Linux command-line interpreter, show the screenshots for executing the following commands: (1) display the current working directory, (2) list the contents of a directory, (3) change directory, (4) create a directory, (5) clear the screen, (6) copy a file from a directory into another directory, (7) delete a directory, (8) delete a file, (9) report information for a single process or set of processes, and (10) report a real-time statistics for current processes.

  • 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...

  • I need help with this. 10-21. Briefly describe the following Linux commands and acronyms. ssh: telnet:...

    I need help with this. 10-21. Briefly describe the following Linux commands and acronyms. ssh: telnet: traceroute: TCP: LAN: DNS: ftp: ssh: ping: env: g++: gcc: 22. Show a command that will create a file named "etc.tar" in your home directory from recursively going through all of the files in the "/etc" directory. In other words, the "etc.tar" file will include the files in the "/etc" directory as well as all of its subdirectories. IMPORTANT: This command must work for...

  • 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...

  • 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...

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