Machine marks on vertical edges are the trickiest and particularly around curves and cutaways. As mentioned above sometimes you need to sand in the same direction as machine marks first and once they have been removed you then revert to sanding in direction of the grain. On vertical sides/edges/end grain you just sand across to achieve the desired smoothness.

Unless you want rounded over edges best to always use a sanding block. Cheap cork ones from any hardware store are great value.