Skip to content

Instantly share code, notes, and snippets.

@Cvetomird91
Created January 28, 2019 13:11
Show Gist options
  • Save Cvetomird91/dd838e920ef9445dfa8ff904cf67129f to your computer and use it in GitHub Desktop.
Save Cvetomird91/dd838e920ef9445dfa8ff904cf67129f to your computer and use it in GitHub Desktop.
#!/bin/bash
REGEX='Matches found for \d* Hz';
MATCHES_FILE='matches.txt';
grep -riP "$REGEX" > "$MATCHES_FILE";
cat $MATCHES_FILE | grep -ohP "$REGEX" | grep -oP \\d* > frequencies.txt
readarray matches < frequencies.txt
rm -f matches.txt frequencies.txt
export matches;
for i in "${matches[@]}"; do
echo $i $(grep -ril $i | wc -l);
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment