Oliver Seitz <[email protected]> said, in message
[email protected]:

> 
> I was recently wondering why my program got so big, so here's a bash
> line which will give a number which can be sometimes interesting:
> 
> cat MyProgram.asm | grep " db " | cut -d 0 -f 2- | fold -1 | grep -c x
> 
> It outputs the number of bytes used in constant tables (for PIC18
> cores, for smaller cores this line would have to be modified).  

Hi all,

Here's how to do it in one command:

awk -F, '($1 ~ / db /){n+=NF;}END{print n;}' MyProgram.asm

> print_string(serial,"This is a text I will output again.")
> print_string(serial,"This is a text I will output again.")
> print_string(serial,"This is a text I will output again.")
> print_string(serial,"This is a text I will output again.")
> print_string(serial,"This is a text I will output again.")  

Spotting this situation can be done as follows:

grep " db " serial.asm | sort | uniq -c | awk '($1 > 1)'

which would list any "db" lines which are duplicated, and the number
of duplications.

Cheers,
Alun.

-- 
Alun Jones,    [email protected],    01970 622494
Gwasanaethau Gwybodaeth / Information Services  
Prifysgol Aberystwyth / Aberystwyth University

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/jallib?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to