Explore BrainMass
Share

Counting uppercase letters in a file

I need to count the number of uppercase letters in the given file "File.txt". Please help me with Bash command(s) to achieve this.

File.txt:

ctctatctgcggcgtgtggcggcgagATGTCTCACAGGAAATTCTCAGCTCCCAGGCATGGGTCCTTGGGCTTCCTGCCTCGCAAGCGCAGCAGCCGGCATCGTGGGAAAGTGAAGAGCTTCCCTAAGGATGACGCTTCCAAGCCCGTTCACCTCACAGCCTTTCTGGGTTACAAGGCTGGCATGACCCACATCGTCCGGGAAGTTGACAGGCCAGGATCTAAGGTGAACAAGAAAGAAGTCGTGGAGGCTGTGACCATTGTGGAAACTCCCCCAATGGTGGTTGTGGGCATTGTGGGATATGTTGAGACCCCACGAGGCCTCCGGACCTTCAAGACTGTATTTGCTGAGCACATCAGCGATGAGTGTAAAAGGCGCTTCTATAAGAACTGGCACAAGTCTAAGAAGAAGGCTTTCACCAAGTACTGTAAGAAATGGCAGGATGACACAGGCAAGAAGCAGCTGGAGAAGGACTTCAACAGCATGAAGAAGTACTGCCAGGTCATCCGCATCATTGCCCACACTCAGATGCGTCTGCTTCCTCTACGCCAGAAGAAGGCACACTTGATGGAGATCCAGGTGAATGGAGGCACTGTGGCTGAGAAGCTCGACTGGGCCCGAGAGCGGCTGGAGCAGCAGGTTCCTGTGAACCAGGTGTTTGGGCAGGATGAGATGATTGATGTCATTGGCGTGACAAAAGGCAAAGGGTACAAAGGGGTAACCAGTCGTTGGCATACAAAGAAACTGCCCCGAAAGACCCATCGAGGTTTGCGCAAAGTTGCCTGTATTGGAGCCTGGCACCCTGCCCGTGTTGCCTTCTCTGTGGCTCGAGCTGGGCAGAAAGGCTACCATCACCGAACAGAGATTAACAAGAAGATTTACAAGATTGGTCAAGGCTACCTCATCAAGGATGGCAAACTGATCAAGAACAATGCATCTACTGACTATGACTTGTCTGACAAGAGCATCAACCCACTGGGTGGCTTTGTGCATTATGGTGAGGTGACCAATGACTTCATCATGCTCAAAGGCTGTGTGGTGGGGACCAAGAAGCGAGTACTTACTCTTCGTAAGTCCTTGCTGGTTCAGACCAAACGTCGGGCCCTGGAGAAGATTGACCTGAAGTTCATTGACACCACCTCCAAATTTGGCCATGGTCGCTTCCAGACCATGGAGGAGAAGAAAGCATTTATGGGACCACTCAAGAAAGATCGCATTGCCAAGGAGGAAGGAGCTTGAttccaggaccactttgtgcagatggtggggtctcaccaataaaatatttctactc

© BrainMass Inc. brainmass.com July 20, 2018, 6:55 am ad1c9bdddf

Solution Preview

You can find the original size of file in characters, using:

wc -c File.txt

You can use following pipeline to ...

Solution Summary

Solution provides an approach that is specific to the given file data, so it will work only with those files that contain only lowercase and uppercase letters.

$2.19