When I try to plot something with linespoints, unless the values that go to the x axis are already sorted within the file, each point gets connected to the point that is on the next line of the file:

Only when I sort the values in the file I can get the desired effect, which is that each point gets connected to the point with one smaller and one larger x value:

Is there a way to do this within gnuplot, without having to sort the files in bash?
sortunder Linux (for Windows you have to install comparable tools, e.g. gnuwin32.sourceforge.net/packages/coreutils.htm). There are cumbersome attempts with gnuplot-only, e.g. stackoverflow.com/q/54144027/7295599. Although, in gnuplot 5.4 there iszsortwhich, however, is not maintaining the order in a two column sort (however only under Windows), see: stackoverflow.com/q/67801386/7295599