#!/bin/sed -f # Remove all comments from c program # if no /* get next /\/\*/!b # here we've got an /*, append lines until get the corresponding # */ :x /\*\//!{ N bx } # delete /*...*/ s/\/\*.*\*\///