The question is how to combine the following commands in one line and use exec.
find . -name '*.txt' -exec sh -c 'echo "$(sed -n "\$p" "$1"),$1"' _ {} \;
The result: path and name of all .txt files.
find . -name '*.txt' -exec sed -n '/stringA/,/stringB/p' {} \;
The result: lines between start and end parameters over all .txt files.
The requested result: give me lines between start and end parameters. The first line must be contain path and name of the .txt file.
find . -name '*.txt' -exec ???? {} \;
./alpha/file01.txt
stringA
line1
line2
stringB
./beta/file02.txt
stringA
line1
line2
stringB
Thanks. T.