-2

I have to calculate space count percentage from hadoop. I'm trying to develop a script related to that. - I'm using command 'hadoop fs -count -q -h /db/xxxxx'

  • this is the output i get 100 T 100.0 T 260 T 16.3 T 51.5 K 672.6 K 81.2 T /db/XXXXX
  • i need to get the 16.3 number to calculate the usage percentage. Anyone did it using similar method? any help is appreciated.!
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

Please refer to this guide to get the best, fastest responses.

Similarly, make sure you're asking the right, real question.
This could easily be an XY Problem. State your end goal, and show what you are currently trying.

Finally, c.f. http://idownvotedbecau.se/ - specifically, No Attempt.

That said, maybe try something like this?

hadoop fs -count -q -h /db/xxxxx | awk -F'[^0-9.]+' '{print $4}'

That tells awk to pattern-split the line on one or morte nondigit(or dot) characters.

Paul Hodges
  • 13,382
  • 1
  • 17
  • 36