#!/bin/bash # Remove leading whitespace and comments starting with // sed -e 's/^[[:space:]]*//' -e '/^\/\/.*/d' $1 | # Remove one line comments starting with // sed -e 's/^\/\/.*$//' | # Remove trailing comments starting with space // sed -e 's/ \/\/.*$//' | # Remove one-line comments starting with /* sed -e 's/\/\*.*//g' | # Remove empty lines sed -e '/^\s*$/d'