I have a .csv datafile created by another 3rd party application that should be plotted using gnuplot
.
Let's assume the file has the following format:
1;2;3;4;5;6 <-- This is the header line that should be ignored (with values 1;2;...;N)
1;1;2;1;1;1
2;3;3;3;5;6
3;4;1;1;1;4
The first column is the x-axis, the following columns should each be plotted as own lineplot (yes, I know, too many line plots within one plot may look bad, but just to get an idea). Here a MCVE:
set terminal png size 1000,500
set datafile separator ";" # CSV file is seperated with ;
plot \
'C://tmp/test.csv' using 1:2 with lines title "A",\
'C://tmp/test.csv' using 1:3 with lines title "B",\
'C://tmp/test.csv' using 1:4 with lines title "C",\
'C://tmp/test.csv' using 1:5 with lines title "D",\
'C://tmp/test.csv' using 1:6 with lines title "E"
The problem is, that this also plots the first line as it would be data.
I know that to can ignore any line in the datafile by starting it with #
, like #1;2;3;4;5;6
, yet I do not want to edit the file, because it is also used by other tools.
Another way is to use plot <filename> every ::1
to ignore the first line, which would mean that I would have to include every ::1
5 times in the above script, as explained in this link. This would look like the following:
set terminal png size 1000,500
set datafile separator ";" # CSV file is seperated with ;
plot \
'C://tmp/test.csv' every ::1 using 1:2 with lines title "A",\
'C://tmp/test.csv' every ::1 using 1:3 with lines title "B",\
'C://tmp/test.csv' every ::1 using 1:4 with lines title "C",\
'C://tmp/test.csv' every ::1 using 1:5 with lines title "D",\
'C://tmp/test.csv' every ::1 using 1:6 with lines title "E"
Is defining every ::1
for every plot really the only way? Is there some shorter - preferable one-liner - way to ignore the first (n) line(s); some way to define the every ::1
"globally" or something like (pseudocode) set datafile ignorefirstnlines 1
?