gram77
asked on
How do I calculate the filesize of myfile.dat in awk?
Here is the script
cat myfile.dat | awk '{print $1 "\t\t" $2;lines++} END {print "Rows--> " lines "Filesize:--> "}'
Data/Result:
TRX TRXAMT
10 100
20 200
30 300
40 400
50 500
Rows-->5 Filesize-->
cat myfile.dat | awk '{print $1 "\t\t" $2;lines++} END {print "Rows--> " lines "Filesize:--> "}'
Data/Result:
TRX TRXAMT
10 100
20 200
30 300
40 400
50 500
Rows-->5 Filesize-->
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ghostdog, ozo:
can you explain how your program works.
Ghostdog: how does a+=$2 calculate file size
ozo: how does a+lines calculate file size.
can you explain how your program works.
Ghostdog: how does a+=$2 calculate file size
ozo: how does a+lines calculate file size.
a+=$2 is equivalent to a=a+$2
ASKER
ghostdog74:
That i know. Could you please tell me how your solution works?
That i know. Could you please tell me how your solution works?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER