Skip to content

Instantly share code, notes, and snippets.

@dietmarw
Created December 20, 2011 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dietmarw/1500980 to your computer and use it in GitHub Desktop.
Save dietmarw/1500980 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Script to create a "Modelica" ready version of the Grammar.html
echo 'readFile("Grammar.html");' > /tmp/a.mos
omc $* /tmp/a.mos > Grammar.mo
# remove first line
sed '1d;3d' -i Grammar.mo
sed -e s#h1\>#h4\>#g -i Grammar.mo
sed -e s#h2\>#h5\>#g -i Grammar.mo
rm /tmp/a.mos
@FND
Copy link

FND commented Dec 21, 2011

You can combine the sed commands:

 $ sed -e 1d -e 2d ...

In fact, you can even do

 $ sed 1,2d ...

@dietmarw
Copy link
Author

Well the problem is that:

$ sed 1,3d ...

will remove lines 1 through to 3 and not 1 and 3. You got a tip on how to solve that?

@dietmarw
Copy link
Author

OK the last change solved it. ; was the key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment