Best Awesome Content
I don't have similar DXF or DWG files handy to test this. However, I quickly whipped up a few lines and an area to check the ability to trim:
1. Convert your DWG polylines to areas (if they aren't already).
2. Select all the lines and all the areas.
3. Right-click, select Crop/Combine/Split Functions, then Crop/Split Selected Line Features to Selected Area Features.
4. When it prompts to Crop or Split, choose "Yes" to trim off the parts of the lines outside the area.
This seems to work even when the lines are intersected by more than one area. Just make sure you selected all of the areas affecting a line or group of lines as this operation needs to be done in one go. I have no idea on the state of the 3D properties of the polylines once you export back out as I don't have a lot of experience with that aspect.