23 June, 2008

Daily Archives

  • UNIX Tools – examples

    Here are a few examples you’ll probably find useful at some point. Counting the number of lines of a C project $ wc -l `find -name “*.[ch]”|xargs` Execute a command on a directory and all its subdirectories $ find “path” -exec “command” {} ; Deleting all the files not accessed for 1 day in the […]

  • grep

    grep is a tool to extract text lines from files (or command outputs using pipes). You’ll use it without end once you’ll know how to do! $ grep pattern from_file $ cat from_file | grep pattern $ some_command_text_output | grep pattern The pattern may be of various formats, of which plain text or regexp. Some […]