Need help in below: I know it's quite big in text, but if you could read it's understandable. I'm having this file cat myfile.txt XSAP_SM1_100 COR-REV-SAPQ-P09 - 10/14/2013 - SCHEDULE XSAP_SM1_100#COR-REV-SAPQ-P09 TIMEZONE Europe/Paris ON RUNCYCLE RULE1 "FREQ=WEEKLY;BYDAY=WE" EXCEPT RUNCYCLE CALENDAR2 FR1DOFF -1 DAYS EXCEPT RUNCYCLE SIMPLE3 11/11/2011 AT 0530 : XSAP_SM1_100#CORREVSAPQP09-01 AT 0640 TIMEZONE Europe/Paris XSAP_SM1_100#CORREVSAPQP09-02 AT 0645 TIMEZONE Europe/Paris
I'm taking the data range after the ':' by using awk 'BEGIN {p=0} {if ($0==":") {p=p+1} else {if (p>0) {print $0} } } END {print ""}' . So I get the required data starting from after : So here I'm fetching the data and creating the variables using for loop.
I should get the final output as - "XSAP_SM1_100","CORREVSAPQP09-01","0640" "XSAP_SM1_100","CORREVSAPQP09-01","0645".
So I have used below ones, which I'm not getting as expected as the for loop for JS is still being executed, but if I execute them in commands I get it.
for FJ in $(cat myfile.txt |
awk 'BEGIN {p=0} {if ($0==":") {p=p+1} else {if (p>0) {print $0} } } END {print ""}' |
grep [A-Z] |
grep -v -i -w -E "AT|CONFIRMED|DEADLINE|TIMEZONE|TZ|DAY|DAYS|EVERY|NEEDS|OPENS|PRIORITY|PROMPT|UNTIL|AWSBIA291I|END" |
awk '{if ($1!="FOLLOWS") {print $1} }')
do
if [[ $(echo $FJ | grep -c "#") -gt 0 ]]
then JCPU=$(echo $FJ | awk -F"#" '{print $1}')
JOB=$(echo $FJ | awk -F"#" '{print $2}')
JST=$(for JS in $(cat myfile.txt |
awk 'BEGIN {p=0} {if ($0==":") {p=p+1} else {if (p>0) {print $0} } } END {print ""}' |
grep [A-Z] |
grep -i "AT ")
do grep "^[0-9]" | awk '{print $2}'
done)
else JCPU=$CPU
JOB=$FJ
fi`enter code here`
# Inserting the row on the import file for the "Jobs in the Streams" table
echo ""$MASTER","$CPU","$S","$JCPU","$JOB","$RECTS""
done
Please suggest me on this.
