I have been trying to remove some improperly formatted lines of output from fortran code I have been using. The problem is that I have some singularities in the math for some points that causes an incorrectly large value to be reported that exceeds the normal formating set in the code resulting in lines that look like (from grep):
-0.97100 -0.23600 -0.02500 0.88100 0.04300 -0.09000 -0.46200 53.914 -8.322 6438515.46 ****************** -72.155
0.64200 0.39200 0.65900 -0.06000 -0.20700 0.70700 -0.67400 46.457 -11.697 148148132.06 ****************** -198.987
Some example lines from the output file given (copy/paste messes up the formating a little, but you can get the picture) :
-0.95000 -0.23700 -0.20300 0.95800 0.13100 -0.07700 -0.24500 61.773 -12.055 264623610.61 538566431.64 -0.638
-0.95000 -0.23700 -0.20300 0.14500 0.33300 0.91800 -0.16100 62.124 -8.243 11146893.11 9371267.73 0.596
-0.97000 -0.23700 -0.06100 -0.52100 -0.72400 0.40400 -0.20100 58.117 -9.802 29371877.18 28037325.06 0.377
-0.97100 -0.23600 -0.02500 0.19900 0.24100 0.83700 0.44900 56.976 -8.890 10397762.98 7138919.32 0.730
-0.97100 -0.23600 -0.02500 0.72400 0.55000 0.13000 -0.39500 56.133 -8.044 5082904.22 17628889.64 -1.201
-0.97100 -0.23600 -0.02500 0.88100 0.04300 -0.09000 -0.46200 53.914 -8.322 6438515.46 ****************** -72.155
-0.97100 -0.23600 0.04700 0.86000 -0.15400 0.15300 -0.46200 50.033 -9.237 15789713.77 12150348.57 0.898
-0.97100 -0.23600 0.04700 -0.11400 -0.69100 -0.20400 0.68400 49.677 -8.322 5778517.84 6907087.88 0.266
-0.97100 -0.23600 0.04700 0.10500 -0.58200 -0.44600 -0.67100 52.463 -8.556 8444383.37 4628898.08 0.893
What I have tried...
I can find all those lines that have the ***** problem using grep as
grep '*/*' file1 > file2
But I need to delete the lines from file1 so that when I redo the incorrect calculations with a more accurate, albeit much slower code, these are not present when using this output file as an input for another step.
Here are the variations of sed that I have used (and all do not work!)
sed '*//d' file1 > file1.keep
sed '//d' file1 > file1.keep
sed '/\/d' file1 > file1.keep
sed '/\*\*\/d' file1 > file1.keep
sed '/**/d' file1 > file1.keep
sed '/^\/d' file1 > file1.keep
I may have tried some other variations but these are the ones I remember at the moment.
So can any one suggest a way to remove the lines with a matching **** using any scripting approach, i.e. sed, awk, etc.
Thanks
Chris