#!/bin/sh
# usage: sched2vc infile outfile
# infile is sampling schedule output from sampsched2d;
# outfile must be placed in /u/exp/stan/nmr/lists/vc;
# converts two values in single line into two lines;
# point (m,n) in sampling schedule is (m-1,n-1) in vclist;
# schedule must start with (1,1), and notice
# first values in vclist belongs to the second sampling point,
# last values in vclist is dummy.
awk 'BEGIN{linenum=1;max1=1;max2=1;} 
(linenum!=1){print linenum*2-1,$1-1; print linenum*2,$2-1;}
($1>max1){max1=$1;}
($2>max2){max2=$2;}
{linenum++;} 
END{print linenum*2-1,0; print linenum*2,0;printf("1 %d sampling points, maximum points l1=%d/l2=%d\n",linenum-1,max2,max1);}' $1 |
sort -n -k1 |
awk 'BEGIN{linenum=1;}
(linenum==1){sub(/1/,"#",$0); print $0;}
(linenum!=1){print $2;}
{linenum++;}' > $2
