The following grep
command that returns the files that contain the string ptrn
. The sed
command skips files using a step stored in stp
.
grep -rl "${isufx[@]}" -e "$ptrn" -- "${fdir[@]}" |
sed "${sta}~${stp}!d" >> $logfl
This would be the result
cat /home/flora/logs/27043-T13:09:44.893003954.log
file1.sh
file2.sh
file3.sh
file4.sh
file5.sh
file6.sh
I would like to end up with the following
cat /home/flora/logs/27043-T13:09:44.893003954.log
File: file1.sh
+ file2.sh
+ file3.sh
+ file4.sh
+ file5.sh
+ file6.sh
I do not think one can do that with grep
though. Some will likely recommend using awk
on the file logfl
.
File:
in 1st line and+
in all other lines?