To just take out the first line
str = "# First line is a grid of y; Starting from second line: first number is a, second is temperature, next is set of numbers is corresponding to f(y) on the grid
0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01
0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02"
(*Method 1*) StringReplace[str, Shortest[head__] ~~ "\n" ~~ rest__ :> rest]
(*Method 2*) #1 <> "\n" <> #2 & @@ Rest@StringSplit[str, "\n"] == %
"0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01
0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02"
True
If there are multiples lines in the header, such as
str = "# First line is a grid of y;
# Starting from second line:
# first number is a
# second is temperature
# next is set of numbers is corresponding to f(y) on the grid
0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01
0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02";
StringReplace[str, ("#" ~~ Shortest[__] ~~ "\n") .. ~~ rest__ :> rest]
"0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01
0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02"
And if there are comments within the data, or actually in any case,
str = "# First line is a grid of y;
# Starting from second line:
# first number is a
# second is temperature
# next is set of numbers is corresponding to f(y) on the grid
0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01
# test comment
0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02";
StringReplace[str, ("#" ~~ Shortest[__] ~~ "\n") :> ""]
"0.000000e+00 0.000000e+00 0.000000e+00 2.500000e-01 5.000000e-01
0.100000e+00 0.000000e+01 0.010000e+02 2.500000e-02 5.000000e-02"
HeaderLines
options for many of the import formats. $\endgroup$