# How to remove comments from Elixir code?

**URL:** <https://forum.elixirforum.com/t/how-to-remove-comments-from-elixir-code/23937>\
**Category:** Questions\
**Tags:** ast\
**Created:** [July 12, 2019, 5:46pm UTC](https://forum.elixirforum.com/t/how-to-remove-comments-from-elixir-code/23937 "2019-07-12T17:46:00Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![chulkilee](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/chulkilee/32/6207_2.png) [@chulkilee](https://forum.elixirforum.com/u/chulkilee)\
**Post date:** [July 12, 2019, 9:06pm UTC](https://forum.elixirforum.com/t/how-to-remove-comments-from-elixir-code/23937/3 "2019-07-12T21:06:28Z")

</div>

I’m already using `sed` but I’d like to handle it with AST so that it doesn’t remove markdown header from multistring `@doc`, for example

Here is a command I usually run after `mix new`

```sh
sed -i '/^ *#/d' \
  .gitignore \
  config/*.exs \
  lib/**/*.ex \
  mix.exs \
  test/**/*.ex \
  test/**/*.exs

mix format

```

---

_[View the full topic](https://forum.elixirforum.com/t/how-to-remove-comments-from-elixir-code/23937)._
