I have a file that reports the size of disks GB's or TB's - I need the file to report everything in MB's. Here is an extract of the file - the last column is the disk size.
19BC 2363 20G
1AA3 2363 2.93T
1A94 2363 750G
Whenever I come across a G I want to delete the G and multiply by 1024 and whenever I get "T" I want to delete the T and multiply by 1048576.
So the output file would look like
19BC 2363 20480
1AA3 2363 3072327
1A94 2363 768000
I had this working to convert the G but then I saw that there were "T"'s in the file and I am struggling to convert G's and T's...Here is what I was using to deal with the G's
cat file | sed 's/G$//g' | awk '{MB=$3*1024; print$1,$2,MB}'