Grab specific line numbers from a file. You give this routine the name of the file and the name of a file that lists the line numbers to be pulled. The lines are written to standard out.
% cat My.File 08:13:38.0523 -05:47:34.784 2000.0 NGC2548 1 18:03:53.0406 -00:17:52.912 2000.0 NGC6535 2 19:05:09.8351 +01:52:19.241 2000.0 NGC6749 2 19:11:10.3102 +01:01:31.802 2000.0 NGC6760 2 19:16:34.5168 +30:10:43.325 2000.0 NGC6779 2 19:53:42.8806 +18:46:57.485 2000.0 NGC6838 2 % cat lines 2 4 % % select_file_lines My.File lines 18:03:53.0406 -00:17:52.912 2000.0 NGC6535 2 19:11:10.3102 +01:01:31.802 2000.0 NGC6760 2This can be an extremely useful script to have.
Fianlly, not that there is another routine that does this sort of thing. It is easier for cutting big, contguous lines from a file. You might look into using cut_by_line for this case.