Concat Two Command Result in File
You can do this with a single awk program:
awk -v OFS=";" ' /STATUS/ {status=$5} /start/ {split($3, a, /;/); start=a[2]} status && start {print status, start; status=start=""}' BIG_DATAfinal.txt
If the output looks like ;2015-03-30o
, then your file has \r\n
line endings, and you should do this:
sed 's/\r$//' BIG_DATAfinal.txt | awk -v OFS=";" ' /STATUS/ {status=$5} /start/ {split($3, a, /;/); start=a[2]} status && start {print status, start; status=start=""}'