Skip to content

Virtually Caffeinated

A double-shot of knowledge

Menu
  • About Me
  • Bookmarks
  • Innovative Store

About Me

Profile
Jeremy Wheeler

I am a Solutions Architect with 30+ years in IT, specializing in cloud architecture, virtualization, and multi-cloud platforms like AWS, Azure, and Google Cloud. I’ve led enterprise projects like VMware’s Horizon Suite Sizing Estimator and have extensive experience with VMware Horizon, Citrix, Hyper-V, and programming languages like PowerShell, Python, and SQL. I run Smart AI Coach (https://smartaicoach.com/), helping individuals leverage AI for resumes, cover letters, and productivity. As a published author, VMware vExpert (2015-2020), and MIT-certified in AI, I am passionate about innovation and solving challenges.

  • Home
  • 2021
  • January
  • 4
  • Log Parsing Cheat Sheet
General Toolbox

Log Parsing Cheat Sheet

Jeremy Wheeler
January 4, 2021December 4, 2024 3 mins

Hey all! So, Doug Arcidino shared with some of our team today this cool cheat sheet that Thomas Roccia @fr0gger_ created. Thomas posted on Twitter two infographics (seen below). I converted the images to text so it’s easier to copy/paste from.

GREPGREP allows you to
search patterns in files.
ZGREP for GZIP files.
$grep <pattern> file.log
-n: Number of lines that matches
-i: Case insensitive
-v: Invert matches
-E: Extended regex
-c: Count number of matches
-I: Find filenames that matches the pattern
NGREPNGREP is used for
analyzing network
packets.
$ngrep -I file.pcap
-d: Specify network interface
-i: Case insensitive
-x: Print in alternate hexdump
-t: Print timestamp
-I: Read pcap file
CUTThe CUT command is
used to parse fields
from delimited logs.
$cut -d -f  2 file.log
-d: Use the field delimiter
-f: The field numbers
-c: Specifies characters position
SEDSED (Stream Editor) is
used to replace strings
in a file.
$sed s/regex/replace/g
s: Search
g: Replace
d: Delete
W: Append to file
-e: Execute command
-n: Suppress output
SORTSORT is used to sort a file.
$sort foo.txt
-o: Output to file
-r: Reverse order
-n: Numerical sort
-k: Sort by column.
-c: Check if ordered
-u: Sort and remove
-f: Ignore case
-h: Human sort
UNIQUNIQ is used to extract
uniq occurrences.
$uniq foo.txt
-c: Count the number of duplicates
-d: Print duplicates
-i: Case insensitive
DIFFDIFF is used to display
differences in files by
comparing line by line.
$diff foo.log bar.log
How +o read output?
a: Add
c: Change
d: Delete
#: Line numbers
<: File 1
<: File 2
AWKAWK is a programming
language use to
manipulate data.
$awk {print $2} foo.log
Print first column with separator
$awk -F: ‘{print $I}’ /etc/passwd

Extract uniq value from two files:
$awk ‘FNR==NR {a[$0]++; next} |($0 in a)’ fl.txt f2.txt
HEADHEAD ¡s used to display
the first 10 lines of a file by default.
$head file.log
-n: Number of lines to display
-c: Number of bytes to display
TAILTAIL is used to display
the last 10 lines of a
file by default.
$tail file.log
-n: Number of lines to display
-f: Wait for additional data
-F: Same as -f even if file is rotated
CSVCUTLESS is used to
visualize the content
of a file, faster than
MORE. ZLESS for
compressed files,
$less file.log
space: Display next page
/: Search
n: Next
g: Beginning of the file
G: Start of the file
+F: Like tail -f
JQCOMM is used to
select or reject lines
common to two files.
$comm foo.log bar.log
Three columns as output:
Column 1: lines only in file 1
Column 2: lines only in file 2
Column 3: lines in both files
-1, -2, -3 Suppress columns output
CSVCUTCSVCUT is used to
parse CSV files.
$csvcut -c 3 data.csv
-n: Print columns name
-c: Extract the specified column
-C: Extract all columns except specified one
-x: Delete empty rows
JQJQ is used to parse
JSON files.
$jq foojson
jq . f.json: Pretty print
jq ‘.[]’ f.json: Output elements from arrays
jq ‘.[0]’.<keyname>’ f.json
TRTR is used to replace a
character in a file.
$tr “;” “,” < foo.txt
-d: Delete character
-s: Compress characters to a single one
Lower to upper every character:
tr “[:lower:]” “[:upper:]” < foo.txt
CCZECCZE is used to color
logs.
$ccze < foo.log
-h: Output in html
-C: Convert Unix timestamp
-l: List available plugins
-p: Load specified plugin
Share :
whosay

Written by  Jeremy Wheeler: Jeremy

I am a seasoned Solutions Architect with over 20 years of expertise in IT, specializing in cloud architecture, virtualization, and end-user computing solutions. My career highlights include working with top-tier technologies across multi-cloud platforms such as AWS, Azure, and Google Cloud. I have a proven track record of leading complex enterprise projects, including the development of tools like VMware’s Horizon Suite Sizing Estimator, which optimized hardware prediction accuracy for customers worldwide. With hands-on experience in virtualization technologies like VMware Horizon, Citrix, and Hyper-V, I excel in designing, deploying, and optimizing full-lifecycle solutions. My technical depth is complemented by 18 years of computer programming experience in PowerShell, Python, C++, .NET, SQL, and more. I am a published author and have contributed to industry literature, including works on desktop virtualization and user environment management. Recognized as a VMware vExpert for six consecutive years (2015-2020), I’ve also received multiple awards for excellence, such as VMware Spotlight and Our Best accolades. Currently, I leverage my knowledge to deliver innovative solutions, combining strategic insights and cutting-edge technologies like AI, as evidenced by my recent certification from MIT. Above all, I thrive on solving challenges and empowering teams to exceed customer expectations.

Post navigation

Previous: Virtually There: Presentations that Pop!
Next: Meeting Automation & Innovation

Related Post

Windows Ghost Network Adapters

Blocksizes of VMFS

vt thumbnail

Virtually There: Presentations that Pop!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

Recent Posts

  • Preventing Hallucination in AI: A Guide Based on Industry Standards
  • Clash of the AI Titans: Gemini 2.5 vs. ChatGPT-4o – Which Reigns Supreme?
  • VMware Explore 2025: Shaping the Future of Multi-Cloud and Edge Technologies
  • AI Trends Shaping the Future in 2025
  • Omnissa vApp and AI: Transforming Application Delivery in 2025

Archives

RSS Press Releases

Copyright VMBUCKET.COM © 2020