Professional Documents
Culture Documents
@FrØgger_
Thomas Roccia
Log Parsing Cheat Sheet 2
HEAD is used to display -n: Number of lines to display
the first 10 lines of a
HEAD file by default.
-c: Number of bytes to display
$head file.log
TAIL is used to display -n: Number of lines to display
TAIL the last 10 lines of a
file by default.
-f: Wait for additional data
-F: Same as -f even if file is rotated
$tail file.log
LESS is used to space: Display next page
visualize the content /: Search
LESS of a file, faster than n: Next
MORE. ZLESS for g: Beginning of the file
compressed files. G: End of the file
$less file.log +F: Like tail -f
Three columns as output:
COMM is used to Column 1: lines only in file 1
select or reject lines
COMM common to two files.
Column 2: lines only in file 2
Column 3: lines in both files
$comm foo.log bar.log -1, -2, -3: Suppress columns output
CSVCUT is used to -n: Print columns name
CSVCUT parse CSV files. -c: Extract the specified column
$ csvcut -c 3 data.csv -C: Extract all columns except specified one
-x: Delete empty rows
JQ is used to parse jq . f.json: Pretty print
JQ JSON files.
$jq . foo.json
jq '.[]' f.json: Output elements from arrays
jq '.[0].<keyname>' f.json
TR is used to replace a -d: Delete character
TR character in a file. -s: Compress characters to a single one
Lower to upper every character:
$ tr ";" "," < foo.txt
tr "[:lower:]" "[:upper:]" < foo.txt
CCZE is used to color -h: Output in html
CCZE logs. -C: Convert Unix timestamp
$ccze < foo.log -l: List available plugins
-p: Load specified plugin
@FrØgger_
Thomas Roccia