# How to extract input part of a notebook?

For example, how to make Mathematica display only the lines beginning with In[some number]?

In[8]:= m1 = {{1, 1, 1}, {8, 4, 2}, {64, 16, 4}}

Out[8]= {{1, 1, 1}, {8, 4, 2}, {64, 16, 4}}

In[9]:= m1.{b1, b2, b3} == {1, 1, 1}

Out[9]= {b1 + b2 + b3, 8 b1 + 4 b2 + 2 b3, 64 b1 + 16 b2 + 4 b3} == {1, 1, 1}

• I've deleted part of your code as not relevant for the question. Feel free to revert this if you want.
– Kuba
Sep 2, 2013 at 19:55

I see three ways:

1. Copy and paste everything into a new notebook (to ensure we don't destroy the output for good). Then select Cell -> Delete All Output from the menu.

2. alt-click (-click on a Mac) on an input cell's bracket. All input cells will get selected. Now copy them and paste them into a new notebook.

3. alt-click (-click on a Mac) on an input cell's bracket. All input cells will get selected. Now press ctrl-' (-' on a Mac). All outputs will be hidden, but they won't be deleted.

(If you need to hide the input and keep the output, you can do the same but start with alt-clicking an output cell.)

4)

SetOptions[#, CellOpen -> False] & /@  Cells[EvaluationNotebook[], GeneratedCell -> True]


But I would choose Szabolcs's 3rd solution.