hi all,
In the file that I should use, there are about 50000 spectra. Each of them starts with '#' and have 6000 rows (with 2 column). Something like:
# spectrum 1
100 23.456
101 23.435
...
# spectrum 2
100 22.456
101 23.435
...
...
...
# spectrum 50000
100 53.456
101 53.435
...
So I have 50000 * 6001 rows alltogether in files. I wrote program in C that process each of these spectra. In the loop, I call awk in order to extract spectrum from these large files into separate file like:
awk '{if (NR == last) break} {if (NR >= first && NR <= last) print $0}' spectra.dat > extraxtedSpectra.dat
where 'first' and 'last' are loop variabeles. I use 'break' statement in awk to fast up extracting the spectrum. Extraction in this case is fast for the first lets say 100 spectra and then slows down. How to make extraction more efficient and faster?
thanks in advance
oliver
In the file that I should use, there are about 50000 spectra. Each of them starts with '#' and have 6000 rows (with 2 column). Something like:
# spectrum 1
100 23.456
101 23.435
...
# spectrum 2
100 22.456
101 23.435
...
...
...
# spectrum 50000
100 53.456
101 53.435
...
So I have 50000 * 6001 rows alltogether in files. I wrote program in C that process each of these spectra. In the loop, I call awk in order to extract spectrum from these large files into separate file like:
awk '{if (NR == last) break} {if (NR >= first && NR <= last) print $0}' spectra.dat > extraxtedSpectra.dat
where 'first' and 'last' are loop variabeles. I use 'break' statement in awk to fast up extracting the spectrum. Extraction in this case is fast for the first lets say 100 spectra and then slows down. How to make extraction more efficient and faster?
thanks in advance
oliver