Doubt with rearranging file through awk

           Filename1.xml  NO  2012-11-16 02:00:27                   20121115/pathname/  asia
          Filename1.rec  YES  2012-11-16 01:20:24                    20121115/pathname 	asia
          FIleName2.xml  YES  2012-11-16 01:20:25                    20121115/pathaname asia

if the file content are properly filled, then below one works fine well with out any other fancy stuff like - or NOT ARRIVED YET

PS: a="02:00:00"
cat aa | awk -v var="$a" '{split($5,a,"/") ; printf ("%8d %15s %60s %10s %10s %5s\n", a[1],$6,$1,var,$4,$2)}'

so I have my desired o/p

20121115     asia                                                Filename1.xml   02:00:00   02:00:27    NO
20121115     asia                                                Filename1.rec   02:00:00   01:20:24   YES
20121115     asia                                                FIleName2.xml   02:00:00   01:20:25   YES

if the content changed a bit, in addition to the existing above records

FIleName3.xml   -                    -                          NOT ARRIVED YET 	asia
FileNamee3.rec  -                    -                          NOT ARRIVED YET 	asia
Filename1.xml   NO   2012-11-16 02:00:27                   	20121115/pathname/    	asia
Filename1.rec  YES  2012-11-16 01:20:24                    	20121115/pathname 	asia
FIleName2.xml  YES  2012-11-16 01:20:25                    	20121115/pathaname   	asia

Then how can I change have my desired o/p as below

20121115     asia                                                Filename3.xml   02:00:00   -    	-
20121115     asia                                                Filename3.rec   02:00:00   -   	-	
20121115     asia                                                Filename1.xml   02:00:00   02:00:27    NO
20121115     asia                                                Filename1.rec   02:00:00   01:20:24   YES
20121115     asia                                                FIleName2.xml   02:00:00   01:20:25   YES

PS: In the o/p file first column will be date which derived from PATH-NAME with DATE from input file and input file could have mix of NOT ARRIVED YET AND PATH with DATE values . PATH with DATE will be always same thru-out the file.

There is a one confusion.
From where above highlighted date should be printed??

Hi Pamu,

the date column in output file has been inherited from the column PATHwithDATE inside input file.

NOT ARRIVED YET
NOT ARRIVED YET
20121115/pathname/
20121115/pathname/
20121115/pathname/

this particular column date with path will never change thru-out the file.

My suggestion,
So , we need to fetch first record where this column != "NOT ARRIVED YET" and then we need to fetch date as by split command in begin section for AWK and thru out the looping we need to call this date value for the first field.

try

awk -v var="$a" 'NR==FNR{if($5 ~ /\//){split($5,a,"/");s=a[1]};next}{
if($0 ~ /NOT ARRIVED YET/){printf ("%8d %15s %60s %10s %10s %5s\n", s,$7,$1,var,$3,$2)}
else { printf ("%8d %15s %60s %10s %10s %5s\n", s,$6,$1,var,$4,$2)}}' file file

it's working fine, other than date column which is coming out as 0 instead of
20121115

---------- Post updated at 05:14 AM ---------- Previous update was at 05:11 AM ----------

      0    asia                                                Filename1.xml   02:00:00   02:00:27    NO
       0     asia                                                Filename1.rec   02:00:00   01:20:24   YES
       0     asia                                                FIleName2.xml   02:00:00   01:20:25   YES
       0            asia                                                FIleName3.xml   02:00:00          -     -
       0            asia                                               FileNamee3.rec   02:00:00          -     -

---------- Post updated at 05:19 AM ---------- Previous update was at 05:14 AM ----------

I did something , it's somehow working, could you verify it

cat aa | awk -v var="$a" '{ if ($5 !~ /ARRIVED/) { if (NR==1) { split($5,a,"/"); date=a[1]} } {
> if($0 ~ /NOT ARRIVED YET/){printf ("%8d %15s %60s %10s %10s %5s\n", date,$7,$1,var,$3,$2)}
> else { printf ("%8d %15s %60s %10s %10s %5s\n",date,$6,$1,var,$4,$2)}}}'
my one question to you
on the same file, why  below o/p looks different
cat aa | awk '{ for (i=1;i<=NR;++i) {print i, $1}}'
1 Filename1.xml
1 Filename1.rec
2 Filename1.rec
1 FIleName2.xml
2 FIleName2.xml
3 FIleName2.xml
1 FIleName3.xml
2 FIleName3.xml
3 FIleName3.xml
4 FIleName3.xml
1 FileNamee3.rec
2 FileNamee3.rec
3 FileNamee3.rec
4 FileNamee3.rec
5 FileNamee3.rec

i have corrected in my previous post. Please don't use hard coded syntax for any definition.

here see below.
NR - Line Number
NF - Number of fields

At start NR = 1 so loop runs only for 1 time. an so on loop increases as NR increases.(You may want to try with NF)

$ awk '{ for (i=1;i<=NR;++i) {print i, $1,NR}}' file
1 FIleName3.xml 1
1 FileNamee3.rec 2
2 FileNamee3.rec 2
1 Filename1.xml 3
2 Filename1.xml 3
3 Filename1.xml 3
1 Filename1.rec 4
2 Filename1.rec 4
3 Filename1.rec 4
4 Filename1.rec 4
1 FIleName2.xml 5
2 FIleName2.xml 5
3 FIleName2.xml 5
4 FIleName2.xml 5
5 FIleName2.xml 5

pamu:)

thanks mate...