Search code examples
bashcut

How do you find the potential size of a file after a grep/cut in Bash?


Let's say you have a very large file with 30 columns, of differing sizes, and you cut out 6 of them. Can you determine the size of the new file that would actually have those 6 columns?


Solution

  • You can use wc:

    grep pattern file | wc -c
    

    It will return number of bytes.