-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrew Beard
committed
Feb 23, 2018
1 parent
a372282
commit cfa0528
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
The Pipe Operator | ||
* Output of one command is fed into the input of the next | ||
* Can thinking of it as a filtering and aggregation pipeline | ||
* In most cases here the first command will be reading from a Bro log file | ||
|
||
sudo dmesg | less | ||
|
||
grep | ||
* Search for a string in the input | ||
* -v inverts the search, printing things that don't contain the string | ||
|
||
cat conn.log | grep dns | ||
|
||
bro-cut | ||
* Specify a subset of a bro log | ||
* Can reorder fields | ||
* -d converts timestamps to human-readable (but timestamp field must be included) | ||
|
||
cat conn.log | bro-cut uid missed_bytes | ||
|
||
sort | ||
* Sort the rows of the input | ||
* -r for reverse, -n for numbers | ||
|
||
cat conn.log | bro-cut missed_bytes uid | sort -n | ||
|
||
uniq | ||
* Remove adjacent duplicated lines | ||
* -c counts the number of occurrences | ||
|
||
cat dns.log | bro-cut query | sort | uniq -c |