Sum size of certain files, print in MB

  • 0

    Given a file "file.txt" which contains the output from a command

    du -sk /path/to/dir/* > file.txt

    which has contents similar to

    3752    source.cpp
    1002    employees.txt
     754     library.h
    2001    module.cpp

    print out the total size of all files that end with the .cpp and .h extension, in MB.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.