I have a command that I'd like to run and get output from. Here's the command:
sh execute_odi_script.sh Audit_ExecutionLogStart.sql heelo
It should return
Begin Informatica Script 18 Redshift Delta copy completed at: 04/10/17 18:46:20 END
Now I need to grab just the output from the SQL file, which is 18
in this case.
Someone was able to help me achieve that, but only if I do it in 2 steps like so:
> logStart=$( sh execute_odi_script.sh Audit_ExecutionLogStart.sql heelo )
> echo $logStart | sed -r s/.*Begin\ Informatica\ Script\ \(\.*\)\ Redshift\ Delta.*/\\1/ ); echo $logStart
18
I've been trying to play around with how I'm doing the command substitution but am having trouble understanding what to even change. How do I do all this in one line?