Skip to content

Instantly share code, notes, and snippets.

@yanivk1984
Last active March 13, 2025 11:35
Show Gist options
  • Save yanivk1984/9df694da25d1ed6b2acfa957c5eda988 to your computer and use it in GitHub Desktop.
Save yanivk1984/9df694da25d1ed6b2acfa957c5eda988 to your computer and use it in GitHub Desktop.
# for string
awk '$3 ~ /snow/ { print }' dummy_file
# for numeric
cpwd_admin list | awk '{if ($4==1) {print $1}}'
# check if column contains a string and print it, will print just the columns containing the lines
mpstat -P ALL 1 1 | awk '$12 ~ /idle/ {print $12}'
# check if column contains a string and print it, if matched string, print all the values in this column
mpstat -P ALL 1 1 | awk '$3 ~ idle {print $12}'
# print specific columns with conditions
awk '$7 > 100 || $8 > 100' filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment