Reading filenames from a bash script
by Faki from LinuxQuestions.org on (#5S6EW)
I would like to read the following logfile so I can capture the file names starting from File:
Code:cat /home/flora/logs/9681-T13:17:07.091363777.org
%rec: dynamic
Ptrn: Gnu
File: /home/flora/comint.rc
+ /home/flora/engine.rc
+ /home/flora/playa.rc
+ /home/flora/edva.rc
+ /home/flora/dyna.rc
+ /home/flora/lin.rcHave started to use
Code:while read -r fl; do
echo "$fl" | grep -oE '[/].+'
done < "$logfl"But I want something more substantial, that actually detects the first File: declaration, then proceeds with the remaining files starting with the continuation character +
The loop needs to produce the following
Code:/home/flora/comint.rc
/home/flora/engine.rc
/home/flora/playa.rc
/home/flora/edva.rc
/home/flora/dyna.rc
/home/flora/lin.rc
Code:cat /home/flora/logs/9681-T13:17:07.091363777.org
%rec: dynamic
Ptrn: Gnu
File: /home/flora/comint.rc
+ /home/flora/engine.rc
+ /home/flora/playa.rc
+ /home/flora/edva.rc
+ /home/flora/dyna.rc
+ /home/flora/lin.rcHave started to use
Code:while read -r fl; do
echo "$fl" | grep -oE '[/].+'
done < "$logfl"But I want something more substantial, that actually detects the first File: declaration, then proceeds with the remaining files starting with the continuation character +
The loop needs to produce the following
Code:/home/flora/comint.rc
/home/flora/engine.rc
/home/flora/playa.rc
/home/flora/edva.rc
/home/flora/dyna.rc
/home/flora/lin.rc