Print folder size ordered by pattern value of specific file type :-) ! challenge !


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Print folder size ordered by pattern value of specific file type :-) ! challenge !
# 1  
Old 03-15-2010
Print folder size ordered by pattern value of specific file type :-) ! challenge !

Hello dear unix command line friends !

I'm looking for a simple combinaison of ls & awk (maybe grep) to print:
list of folders of a directory
|_ ordered by size

like what I have with
Code:
$ du -sk ./* | sort -rn

printing that result:
Code:
8651520 ./New Virtual Machine_1
8389120 ./Redhat

then
I would like to have, instead or concatenated of the folder name the content of a specific line in a specific file type in the folder
like what I have with
Code:
$ cat ./New\ Virtual\ Machine_1/*.vmx | grep displayName
$ cat ./Redhat/*.vmx | grep displayName

that prints
Code:
displayName = "Redhat 5.4"
displayName = "Redhat"

I think of something like passing in my 2nd cat command the list of folder from a simple
Code:
ls -1

But all of that, simple, in one line ... using awk ?
Don't kwow....

And I know something else, I'm sure, for someone who get used, that it's quite easy with knowledge Smilie

please... Smilie

Best final result would be:
Code:
8651520;New Virtual Machine_1;Redhat 5.4
8389120;Redhat;Redhat

# 2  
Old 03-16-2010
Tools

Up :-o

no ideas ?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print all lines between two keyword if a specific pattern exist

I have input file as below I need to check for a pattern and if it is there in file then I need to print all the lines below BEGIN and END keyword. Could you please help me how to get this in AIX using sed or awk. Input file: ABC ******** BEGIN ***** My name is Amit. I am learning unix.... (8 Replies)
Discussion started by: Amit Joshi
8 Replies

2. Shell Programming and Scripting

awk to print record not equal specific pattern

how to use "awk" to print any record has pattern not equal ? for example my file has 5 records & I need to get all lines which $1=10 or 20 , $2=10 or 20 and $3 greater than "130302" as it shown : 10 20 1303252348212B030 20 10 1303242348212B030 40 34 1303252348212B030 10 20 ... (14 Replies)
Discussion started by: arm
14 Replies

3. UNIX for Dummies Questions & Answers

look for file size greater than "0" of specific pattern and move those to another directory

Hi , i have some files of specific pattern ...i need to look for files which are having size greater than zero and move those files to another directory.. Ex... abc_0702, abc_0709, abc_782 abc_1234 ...etc need to find out which is having the size >0 and move those to target directory..... (7 Replies)
Discussion started by: dssyadav
7 Replies

4. UNIX for Dummies Questions & Answers

How to Detect Specific Pattern and Print the Specific String after It?

I'm still beginner and maybe someone can help me. I have this input: the great warrior a, b, c and what i want to know is, with awk, how can i detect the string with 'warrior' string on it and print the a, b, and c seperately, become like this : Warrior Type a b c Im still very... (3 Replies)
Discussion started by: radynaraya
3 Replies

5. Programming

Print specific pattern line in c++

Input file: @HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC +HWI-BRUNOP1_header_1 TNTTJTTTETceJSP__VRJea`_NfcefbWe Desired output file: >HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC >HWI-BRUNOP1_header_2... (10 Replies)
Discussion started by: cpp_beginner
10 Replies

6. Shell Programming and Scripting

How to copy specific file.txt in specific folder?

hye there... i have a problem to copy file in specific folder that will change the name according to host,time(%m%s) and date(%Y%M%D) example folder name: host_20100531.154101801 this folder name will always change... but i just want to copy the AAA.txt and BBB.txt file.. really need... (17 Replies)
Discussion started by: annetote
17 Replies

7. Shell Programming and Scripting

Print out specific pattern column data

Input file: adc_0123 haa_1000 bcc_520 adc_0150 bcc_290 adc_0112 haa_8000 adc_0139 haa_7000 Output file: adc_0123 adc_0123 haa_1000 bcc_520 adc_0150 adc_0150 bcc_290 (3 Replies)
Discussion started by: patrick87
3 Replies

8. Shell Programming and Scripting

Print rows, having pattern in specific column...

Hello all, :) I have a pattern file some what like this, cd003 cd005 cd007 cd008 and input file like this, abc cd001 cd002 zca bca cd002 cd003 cza cba cd003 cd004 zca bac cd004 cd005 zac cba cd005 cd006 acz acb cd006 cd007 caz cab cd007 ... (25 Replies)
Discussion started by: admax
25 Replies

9. Shell Programming and Scripting

How to get the size of tar,Z,gz type file.

Hi, How to get the size of the .tar file .Z file .gz file. Please help me what command i need to use in shell scripting :( Regards, Kalai (3 Replies)
Discussion started by: kalpeer
3 Replies

10. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies
Login or Register to Ask a Question