LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   printing filesizes greater than 1 mb (http://www.linuxquestions.org/questions/linux-newbie-8/printing-filesizes-greater-than-1-mb-627767/)

sknowonweb 03-13-2008 09:43 AM

printing filesizes greater than 1 mb
 
Hi all ,
I need to print the filesizes and files in my home directory which are greater than 1 Mb . preferably both the filesizes and the file path
i tried

du -h ~ | awk '{print $1}' | grep M

It gives me just the first column , but i got all the indicator containing M as suffix , indicating they are greater than a MB .
then i tried

du -h | awk '{print $1 , $2}' | grep M

But it grep's all the file names which contains the letter 'm' in it and the out put contains files like .
[
68K ./Equitywatch/HTMLs/Appa
92K ./Equitywatch/HTMLs/Ramesh
]
all I need is like , it should grep the 'M's from the first column , and also prints out both first and second column .

Like
[
14M ./.thunderbird/vtqnx8nq.default/ImapMail/mailhost
14M ./.thunderbird/vtqnx8nq.default/ImapMail
]
for the entire home directory

can some one helps me out framing the arguments so that the out willbe like the one above

Agrouf 03-13-2008 09:53 AM

find . -size +1M -exec ls -lh {} \;

sknowonweb 03-13-2008 10:16 AM

Thanks Agrouf .

Merci ..

That was great
i used this to achieve my kinda output .

find . -size +1M -exec ls -lh {} \; | awk '{print $5 , $8}'

Thanks for the swift response .


All times are GMT -5. The time now is 12:33 AM.