On Mon, Jun 28, 2021 at 07:25:37PM +0200, lisa-asket@perso.be wrote:
> Would like as below
>
> ==> foo <==
>
> b
> c
> d
>
> ==> bar <==
>
> 2
> 3
> 4This is similar to results using `head`.
This is why we want the full problem definition up front. Piecemeal
modifications always lead to multiple complete rewrites. It's VERY
frustrating.
Here's one way, using GNU or BSD find's -print0 action to feed a
machine-readable list of pathnames into a while-read loop:
find "$3" \( ... \) -print0 |
while IFS= read -r -d '' file; do
printf '==> %s <==\n' "$file"
sed -n "$1,${2}p" "$file"
done