One (Illustrator) method....

- Move (or copy) the rectangle so it is on top of the paths.

- Select the lines and this top rectangle.

- Click the **Divide** button on the **Pathfinder Panel** (Window > Pathfinder)

- Simply delete what you don't want.