It is possible to automatically save a notebook as a Package (see https://mathematica.stackexchange.com/a/1370/5340). The generated package file only contains the cells marked as Code.
This has the advantage that you can exploit the notebook formatting capabilities (such as display fractions), which are converted to plain text in the generated package.
How can I do the same with a Wolfram Script?
#!/usr/bin/env wolframscript, and the .wls is executable by default. – a06e Apr 05 '18 at 12:14