Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried several commands: tr, sed but to no avail. Here's the file:

> ...
> ...
> setEPS()
> postscript('images/boxplot_default.eps')
> ...
> ...

I want to delete those two undotted lines. Something simple like /> setEps\(\)\n/ would do.

share|improve this question
up vote 1 down vote accepted

Ok, finally got it: use perl!

perl -i -p -e 's/> setEPS\(\)\n//g' filename

so, the final command:

perl -0777 -i -pe 's/\> setEPS\(\)\n\> postscript\([^\n]*\n\> \n//g' ${output}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.