Process Jenkins console output

I am running terraform module in jenkins pipeline it was generating output I want to fecth all terraform output block out of jenkins console log and create file out of it can anyone please share some Idea.

Just redirect the output to a file and save it as an artifact.

Run this as a script:

apt update && apt install -y wamerican
echo "This is a task running"
echo "Terraform running now" > output.txt
cat /usr/share/dict/words | sort -R | head -1024 >> output.txt

Add Archive the artifacts in the Post-build Actions:

*.txt

Then you get this in the job run: