Monday, February 7, 2011

Can I get all the file extensions of text files in the repository in CVS ?

I need a list of all file types of text files in CVS (such as .cpp,.h etc. )

can it be done?

  • I know it's quick and dirty but you can play with regular expressions, grepping, redirecting to a file, sorting...(blah blah blah):

    cvs ls -R [path to repo] | grep "\.[A-Za-z0-9]*$" | sed 's/.*\(\.[A-Za-z0-9]*\)$/\1/' > fileExtensions && sort fileExtensions | uniq
    

    Explanation:

    • list all files in the repository
    • print only those with an extension
    • extract the extension with sed
    • redirect output to a file
    • sort the file, then print unique lines
    Scoregraphic : You're assuming he's using Linux
    danieli : Yeah, or any decent *NIX OS (Solaris, BSD, etc.)
    Oded : I'm using Windows :-)
    William Pursell : @Scoregraphic: there is no assumption about Linux or *nix. The only assumption is the existence of the tools grep, sed, cvs, and uniq and the syntax for piping and redirecting output.
    William Pursell : sort | uniq can be replaced with sort -u
    From danieli

0 comments:

Post a Comment