svgcleaner could help you to clean up your SVG files from the unnecessary data.

A complete documentation can be found here: https://github.com/RazrFalcon/svgcleaner/blob/master/docs/svgcleaner.adoc

USAGE:
    svgcleaner [FLAGS] [OPTIONS] <in-file> <out-file>

    <FLAG> can contain values: true, false, yes, no, y, n

EXAMPLES:
    clean a file with default options:
    svgcleaner in.svg out.svg

    clean a file with custom options:
    svgcleaner --indent=2 --paths-coordinates-precision=5 --join-arcto-flags=yes in.svg out.svg

    clean a file without default options:
    svgcleaner --no-defaults --remove-comments=yes in.svg out.svg

    clean a stream using UNIX pipes:
    cat in.svg | svgcleaner -c - > out.svg

FLAGS:
    -h, --help                              Print help information
    -V, --version                           Print version information
    -c, --stdout                            Print result to the standard output
        --no-defaults                       Reset default flags to 'no'
        --multipass                         Clean a file multiple times
        --allow-bigger-file                 Allow bigger file
        --copy-on-error                     Copy an original file to the destination on error
        --quiet                             Show only warnings and errors

OPTIONS:
Elements:
    --remove-comments <FLAG>                Remove XML comments [default: yes]
    --remove-declarations <FLAG>            Remove XML declarations [default: yes]
    --remove-nonsvg-elements <FLAG>         Remove non-SVG elements [default: yes]
    --remove-unused-defs <FLAG>             Remove unused referenced elements [default: yes]
    --convert-shapes <FLAG>                 Convert basic shapes into paths [default: yes]
    --remove-title <FLAG>                   Remove 'title' element [default: yes]
    --remove-desc <FLAG>                    Remove 'desc' element [default: yes]
    --remove-metadata <FLAG>                Remove 'metadata' element [default: yes]
    --remove-dupl-lineargradient <FLAG>     Remove duplicated 'linearGradient' elements [default: yes]
    --remove-dupl-radialgradient <FLAG>     Remove duplicated 'radialGradient' elements [default: yes]
    --remove-dupl-fegaussianblur <FLAG>     Remove duplicated 'feGaussianBlur' elements [default: yes]
    --ungroup-groups <FLAG>                 Ungroup groups [default: yes]
    --ungroup-defs <FLAG>                   Ungroup 'defs' element [default: yes]
    --group-by-style <FLAG>                 Group elements by equal styles [default: yes]
    --merge-gradients <FLAG>                Merge gradients [default: yes]
    --regroup-gradient-stops <FLAG>         Regroup gradient 'stop' elements [default: yes]
    --remove-invalid-stops <FLAG>           Remove invalid 'stop' elements [default: yes]
    --remove-invisible-elements <FLAG>      Remove invisible elements [default: yes]
    --resolve-use <FLAG>                    Resolve 'use' elements [default: yes]

Attributes:
    --remove-version <FLAG>                 Remove 'version' and 'baseProfile' attributes [default: yes]
    --remove-nonsvg-attributes <FLAG>       Remove non-SVG attributes [default: yes]
    --remove-unreferenced-ids <FLAG>        Remove unreferenced 'id' attributes [default: yes]
    --trim-ids <FLAG>                       Trim 'id' attributes [default: yes]
    --remove-text-attributes <FLAG>         Remove text-related attributes if there is no text [default: yes]
    --remove-unused-coordinates <FLAG>      Remove unused coordinate attributes [default: yes]
    --remove-default-attributes <FLAG>      Remove attributes with default values [default: yes]
    --remove-xmlns-xlink-attribute <FLAG>   Remove an unused 'xmlns:xlink' attribute [default: yes]
    --remove-needless-attributes <FLAG>     Remove attributes that doesn't belong to this element [default: yes]
    --remove-gradient-attributes <FLAG>     Remove inheritable gradient attributes [default: no]
    --join-style-attributes <VALUE>         Join presentational attributes [values: no, some, all] [default: some]
    --apply-transform-to-gradients <FLAG>   Apply transformations to gradients [default: yes]
    --apply-transform-to-shapes <FLAG>      Apply transformations to shapes [default: yes]
    --remove-unresolved-classes <FLAG>      Remove unresolved classes from 'class' attributes [default: yes]

Paths:
    --paths-to-relative <FLAG>              Convert path segments into relative ones [default: yes]
    --remove-unused-segments <FLAG>         Remove unused path segments [default: yes]
    --convert-segments <FLAG>               Convert path segments into shorter ones [default: yes]
    --apply-transform-to-paths <FLAG>       Apply transformations to paths [default: no]
    --trim-paths <FLAG>                     Use compact notation for paths [default: yes]
    --join-arcto-flags <FLAG>               Join ArcTo flags [default: no]
    --remove-dupl-cmd-in-paths <FLAG>       Remove subsequent segments command from paths [default: yes]
    --use-implicit-cmds <FLAG>              Use implicit LineTo commands [default: yes]

Output:
    --trim-colors <FLAG>                    Use #RGB notation [default: yes]
    --simplify-transforms <FLAG>            Simplify transform matrices [default: yes]
    --coordinates-precision <NUM>           Set coordinates numeric precision (1..12) [default: 6]
    --properties-precision <NUM>            Set properties numeric precision (1..12) [default: 6]
    --transforms-precision <NUM>            Set transform values numeric precision (1..12) [default: 8]
    --paths-coordinates-precision <NUM>     Set path's coordinates numeric precision (1..12) [default: 8]
    --list-separator <SEPARATOR>            Set number list separator [values: space, comma, comma-space] [default: space]
    --indent <INDENT>                       Set XML nodes indent [values: none, 0, 1, 2, 3, 4, tabs] [default: none]

ARGS:
    <in-file>                               Input file
    <out-file>                              Output file
