I am using the SAC tool to read the header information but some files have no header information and it prints an error. Is there any way to use AWK to print that files if they do not have a header or error during work. I often used AWK for data manipulation but failed this time.
Here is my try:
saclst a f *2020-05*BHZ*
This is the output
GS.GS043.2020-05-18T03:52.BHZ.sac 3.37
GS.GS043.2020-05-18T09:28.BHZ.sac 3.64
GS.GS043.2020-05-18T12:09.BHZ.sac 3.42
saclst: Error determining SAC header: GS.GS043.2020-05-18T14:36.BHZ.sac
GS.GS043.2020-05-18T16:25.BHZ.sac 2.92
GS.GS043.2020-05-18T18:51.BHZ.sac 3.66
Now I want to get the file name and print it but seems like AWK does not help;
saclst a f *2020-05*BHZ* | awk '{if ($2<0) print $1;}' > ../test.dat
My output file is empty and the terminal shows this error:
Is there any way to save this error so I can later modify it?
saclst: Error determining SAC header: SC.LZB.2020-05-21T10:46.BHZ.sac
saclst: Error determining SAC header: SC.LZB.2020-05-21T11:57.BHZ.sac
saclst: Error determining SAC header: SC.LZB.2020-05-26T11:23.BHZ.sac
saclst: Error determining SAC header: SC.LZB.2020-05-28T10:44.BHZ.sac
saclst: Error determining SAC header: SC.QSC.2020-05-12T06:49.BHZ.sac