Filter the file list greater then the size specified by user

HI,

Can any tell me how to filter the list of files greater than the size specified by user. The size should be provided by user as an input.

Regards
shiva

Same question as in this thread:

Maybe try out some of the code examples given.

I tried it but its not working with the variable, its displays all the files. its only working correctly if i is an integer instead of variable

reagrds
shiva

What I tried to explain to the user in the other thread I try to explain to you too. When you get the value by "du" for example, either get it without a size description like "k" for kilobyte (other user used "du -ah" giving stuff like 12K as output), or just strip the character so that only numbers remain.

You are not also the user vivek.bharadwaj?

It is not the problem for awk to compare numbers since it doesn't make a difference between the string 100 and the integer 100. Problem is the 100K! This is alphanumeric stuff awk can't compare to a number.

I am not him and he is not me :slight_smile: . I've removed that k factor by removing the -h option from du but it hasnt brought me any closer to finding the solution.

I have tried this but have some problem pls correct it
du -ah | awk '$1 > s' s="$filesize" is not working properly. Its only comparing the first digit of the size.

Good thing, vivek :wink:

No guys, it is not comparing only the 1st digit. I don't know how you come to that impression. Check vivek's thread, I've updatet it. I am closing this thread since it is the same topic like vivek's so continue in his thread for the ease of following threads, please.

Closed :wink: