Question

In: Computer Science

Unix / Linux 21. Given the following command pipeline, provide a diagram (ascii art) or detailed...

Unix / Linux

21.

Given the following command pipeline, provide a diagram (ascii art) or detailed description indicating all the Input/Output (I/O) connections. Every stdin, stdout, and stderr for each command will need to connect to something.

grep a < words | wc -l > a_count.txt

22.

Explain what is wrong (if anything) with the following command pipeline.

cd | ls

23.

Stream Editor:

Write a sed command to delete digits, but only on lines that end with a period. Assume a file named exam.txt is used for input and changes will be displayed to the screen and not saved to the file.

24.

ls command

What option is used to format the output in a single column?

25.

ls command:

List two different options that will indicate "file type" in the output. Explain.

Solutions

Expert Solution

21) grep a < words | wc -l > a_count.txt

this command is used to find certain things on file or text. but here angular brackets are used, so the expression evaluated first. there can be two cases... as mentioned here

a) no words file, then it will generate error and display it on the screen that words no such file.

b) there is words file, then the total line will be counted in that file, and then at the end command will generate error. saying that no such token found.

22) cd|ls

since there is not error in the given pipe line, this will simply foward the return code of cd command to the command ls. and this command will only gives the output of ls command which is nothing but the content of the current directory.

23) sed -e '/^[0-9].*$/d' exam.txt

This command will perform said task.

24) ls -1

ls --format=single-column

this command will give output in single column.

25) first option with ls command is "-l"

it will show output along with type of file like as mentioned below:

  1. - : regular file
  2. d : directory
  3. c : character device file
  4. b : block device file
  5. s : local socket file
  6. p : named pipe
  7. l : symbolic link

second option is "-F" it will append * to the file and / to the directory.

So, -l and -F are two ways.

Hope this helps.


Related Solutions

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 16. Regular Expression: Given the following regular expression, provide a description of the...
Unix / Linux 16. Regular Expression: Given the following regular expression, provide a description of the intended match. ^[^A-Z] 17. Regular Expression: Given the following regular expression, provide a description of the intended match. [^^!] 18. Regular Expression: Given the following regular expression, provide a description of the intended match. ^.\{72\}$ 19. Regular Expression: Given the following regular expression, provide a description of the intended match. [A-Za-z0-9] 20. Regular Expression: Given the following regular expression, provide a description of the...
Provide a full detailed comparison table of the differences between Windows, Solaris, Unix,Linux OS and MacOS
Provide a full detailed comparison table of the differences between Windows, Solaris, Unix,Linux OS and MacOS
please use linux or unix to complete Diff command The diff command displays differences between two...
please use linux or unix to complete Diff command The diff command displays differences between two files on a line-by-line basis. It displays the differences as instructions that you can use to edit one of the files ( using the vi editor) to make it the same as the other. When you use diff, it produces a series of lines containing Append (a), Delete (d), and Change (c) instructions. Each of these lines is followed by the lines from the...
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...
Using sed unix / linux command how would I execute this: Move the first 2 characters...
Using sed unix / linux command how would I execute this: Move the first 2 characters on each line to the end of the line
In LINUX Provide the command(s) and any additional steps to perform the following tasks. You will...
In LINUX Provide the command(s) and any additional steps to perform the following tasks. You will need to be running with root privileges. Create a symlink to the /etc/openldap/ directory named "ldapconf" in /tmp/. Find all .conf files in the /etc/ directory and its subfolders. Find all directories starting with "gnome" or "GNOME" anywhere under the /usr/share/ directory. Sam and Susan are members of the "sales" group. Sam has been working on a project that has grown too big for...
Unix / Linux 31. Given the first two commands, what is the expected output for the...
Unix / Linux 31. Given the first two commands, what is the expected output for the third command? (single quotes) $ echo * a b c $ x=* $ echo '$x' 32. Given the first two commands, what is the expected output for the third command? (Single quotes inside of double quotes) $ echo * a b c $ x=* $ echo "'$x'" 33. Given the first two commands, what is the expected output for the third command? (double quotes...
Please provide a detailed answer with justifications to the following question: Given the large number and...
Please provide a detailed answer with justifications to the following question: Given the large number and large population of emerging countries, many economists and environmentalists are genuinely concerned about the depletion of resources, child labor practices, and political tensions within emerging countries. Do you think we should be worried? if so why; if no, why not?
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you...
Using Linux in VirtualBox Do the Following Exercise: Using the clear command At this point, you screen might seem filled with commands and their results. Use the clear command anytime you want a clean slate. This exercise enables you to clear the screen now. To clear the screen: Type clear on the command line, and press Enter. The command prompt is now in the upper-left corner of your screen. [No output or questions for this part.] Viewing manual pages You...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT