User Tools

Site Tools


wiki:pipes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:pipes [2015/11/16 13:53]
asa [grep: print lines that match a pattern]
wiki:pipes [2016/08/02 14:47] (current)
Line 22: Line 22:
 </​code>​ </​code>​
 The ''​sort''​ command sorts its input (a file) and writes its output to standard-output. The ''​sort''​ command sorts its input (a file) and writes its output to standard-output.
- 
-If we would like to know how many files we have in those file  
- 
  
 ==== wc:  counting lines, words, bytes ==== ==== wc:  counting lines, words, bytes ====
Line 41: Line 38:
 Here's the general form of the command: Here's the general form of the command:
 <​code>​ <​code>​
-wc [file_name ​...]+wc [File ...]
 </​code>​ </​code>​
 What does this tell us? What does this tell us?
Line 73: Line 70:
 The general format for the command is: The general format for the command is:
 <​code>​ <​code>​
-grep [file ... ]+grep [File ... ]
 </​code>​ </​code>​
 and it also has a few options. and it also has a few options.
Line 90: Line 87:
 </​code>​ </​code>​
  
 +===== In class exercise ====
  
 +  - Write a command that counts the number of directories and files in your home directory that start with D?  Note that you will need to look at the man page of ''​ls''​ to find an appropriate option to use.
 +  - What is the difference between ''?''​ and ''​*''? ​ Demonstrate that with a couple of commands.
 +  - Create a text file using a command-line utility and write a command that sorts the contents of the file and puts the result into a file called ''​sorted.txt''​.
  
wiki/pipes.txt ยท Last modified: 2016/08/02 14:47 (external edit)