Skip to content

Instantly share code, notes, and snippets.

@ocommaj
Created May 19, 2021 01:47
Show Gist options
  • Save ocommaj/f7ffdfc5cd1d7adb64c7b71f23f70e07 to your computer and use it in GitHub Desktop.
Save ocommaj/f7ffdfc5cd1d7adb64c7b71f23f70e07 to your computer and use it in GitHub Desktop.
#! /bin/bash
find_me="Process image"
results=()
next_idx=0
while read -r LineFromFile || [[ -n "${LineFromFile}" ]]; do
if [[ $LineFromFile =~ "$find_me" ]]; then
results[$next_idx]=$LineFromFile
next_idx=$((next_idx+1))
fi
done<"$1"
for line in "${results[@]}"; do
echo "$line"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment