I have troubled u a lot....
let me explain what is happening on my machine..
till this both give same out put
Quote:
tsort temp1 | sed '$d' | nl | sort -nr | cut -f2 | nl | awk '{print $2, $1}'
after that
changes the order..
but i dont know y it shows as all 1's in the 3rd column...
and then
Quote:
| sort -k 3n | awk '{print $1,$2}' |
that gets me the Job name and the interger ... doestnt get me the job and predecessor as expected...
thats y i thought that i might be
instead of
..
the join of temp1 and - doesnt get me the job and predeessor...
Please throw some light on it...
thanks for all the help...
if i am right
sort $1 > temp1
tsort temp1 --- does the topological sort
sed '$d' --- deletes the last line which is 0 in our case
nl --- appends line numbers to each line
sort -nr --- sort the file in reverse based on the line numbers given by previous nl command
cut -f2 --- gets the job name back ...
nl --- again a line number appending
awk '{print $2, $1}'--- gets the job name followed by line number to be printed
sort --- sort on the job name
join temp1 - --- ??????? dont know exactly what it does.... { i thought it joins the Job name to its predecessor}
sort -k 3n ---- sort on the 3rd field
awk '{print $1,$2}' -- prints the first two columns... (in this case i thought the first 2 colums would be the job name, line number )
the next login i flaw less i think the tsort is fine....
awk '{r[NR]=$0 ; k[NR]=$1 ; if(v[$1]<1+v[$2]) v[$1]=1+v[$2] } END { for (n=1; n<=NR; n++) print r[n] , v[k[n]]}'
I am counting on You people only....
Please dont desert me.....