I'm trying to convert a large shapefile (more than 20,000 polygons) to a text file to use in a modelling software. It needs to be in a specific format which is number of nodes, followed by all x coordinates followed by all y coordinates with each polygon on a new line (Pictured below) (first line is total number of polygons).
Currently I am using QGIS 3.6.3 and saving the shapefile as a CSV using WKT geometry. This however does not include the number of nodes and coordinates are formatted as xy xy. Please note that I am not constrained to QGIS.