Script to recursively grep data from certain files in the directory
- by Jude
I am making a simple shell script which will minimize the time I spend in searching all directories under a parent directory and grep some things inside some files. Here's my script.
#!/bin/sh
MainDir=/var/opt/database/1227-1239/
cd "$MainDir"
for dir in $(ls); do
grep -i "STAGE,te_start_seq Starting" "$dir"/his_file | tail -1 >>…