Skip to content

Instantly share code, notes, and snippets.

@macoj
Created September 14, 2018 11:37
Show Gist options
  • Save macoj/b01d2d71be9dc3a7893308bd3f6b612e to your computer and use it in GitHub Desktop.
Save macoj/b01d2d71be9dc3a7893308bd3f6b612e to your computer and use it in GitHub Desktop.
Filter some data based on some criteria with awk
#!/bin/bash
bb0=$1
bb1=$2
bb2=$3
bb3=$4
cat data.dat | awk -F '|' -v bb0="$bb0" -v bb1="$bb1" -v bb2="$bb2" -v bb3="$bb3" '$2 > bb0 && $2 < bb1 && $3 > bb2 && $3 < bb3 {print $0}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment