The header argument :noweb no-export
(or another option, dpending on your need) will help you. See here for more information.
EDIT: As suggested by @Drew a small summary of the :noweb
arguments. The table below shows with which argument the code block will be expanded before what action:
| :noweb argument| evaluate | tangle | export |
|----------------+----------+--------+---------|
| no | | | |
| yes | yes | yes | yes |
| tangle | | yes | |
| no-export | yes | yes | |
| strip-export | yes | yes | removed |
| eval | yes | | |
Here a small example that shows how to apply the header argument to the source block:
* Example Use
#+begin_src sh :noweb-ref all
echo "all"
#+end_src
#+begin_src sh :noweb no-export :tangle example.sh
<<all>>
echo "more"
#+end_src
Please note that you have more options to set the header arguments. You can set them for example system wide or on a per file and subtree basis:
* Header arguments
** System wide
Set variable ~org-babel-default-header-args~:
#+BEGIN_SRC emacs-lisp
(setq org-babel-default-header-args '((:exports . "code")))
#+END_SRC
** Per file
#+property: header-args :eval no
#+property: header-args:ditaa :eval yes
*** Per Subtree
:PROPERTIES:
:header-args: :cache yes
:END: