This is the original data file:
$ cat filesize.dat
Code:
index.html 352
logo.jpg 422
introduction 34
This is a script preparing data for gnuplot:
$ cat script.sh
Code:
#!/bin/sh
IFS.old=$IFS
IFS='
'
declare -i n=0
> filesize.numbered.dat
> filesize.numbered.gnuplot.dat
for line in `cat filesize.dat`
do
n=$n+1
echo "$n $line" >> filesize.numbered.dat
echo "$n `echo $line | awk '{print $2}'`" >> filesize.numbered.gnuplot.dat
done
This is human readable output with numbered lines:
$ cat filesize.numbered.dat
Code:
1 index.html 352
2 logo.jpg 422
3 introduction 34
This is gnuplot readable output with numbered lines but without file’s names:
$ cat filesize.numbered.gnuplot.dat
This is the session with gnuplot:
$ gnuplot
Code:
$ gnuplot
gnuplot> set terminal png color
gnuplot> set output 'filesize.numbered.gnuplot.png'
gnuplot> plot 'filesize.numbered.gnuplot.dat' with lines
gnuplot> quit
This is your chart: filesize.numbered.gnuplot.png.
I don't insist it's the simplest solution. Someone can suggest something simpler or more elegant.