Basically what I want to do is to make a script that will output all the files and their sizes in the directory which have size more than a threshold value (2.2 GB in my case). I tried using the stat command as below
a=$(stat -c '%s' example.txt)
but this will store the file size in bytes. What I want is to store and display the size in human readable format(MB,GB). I was also thinking to store the output of
ls -lah and then trim the result so as to store only name and size but that seemed a tedious task. Is there other anyway to do this apart from storing the result in bytes and then doing arithmetic operations on it.