I'm using dicom_hdr to look at the siemens extra data for some files when I tell grep to exit after the first match:
some scans have no problem either way:
> dicom_hdr -sexinfo $dcmfile1 | grep 'lOffset'
sGRADSPEC.lOffsetX = -1500
> dicom_hdr -sexinfo $dcmfile1 | grep -m1 'lOffset'
sGRADSPEC.lOffsetX = -1500
Other scans are fine with a normal grep, but throws a fit if I "grep -m1":
> dicom_hdr -sexinfo $dcmfile2 | grep 'lOffset'
sGRADSPEC.lOffsetX = -1054
> dicom_hdr -sexinfo $dcmfile2 | grep -m1 'lOffset'
sGRADSPEC.lOffsetX = -1054
Fatal Signal 13 (SIGPIPE) received
dicom_hdr main
Bottom of Debug Stack
** AFNI version = AFNI_2011_12_21_1014 Compile date = Jul 30 2013
** [[Precompiled binary linux_openmp_64: Jul 30 2013]]
** Program Abort **
** If you report this crash to the AFNI message board,
** please copy the error messages EXACTLY, and give
** the command line you used to run the program, and
** any other information needed to repeat the problem.
** You may later be asked to upload data to help debug.
The failures usually happen on non-product sequences, but does fail on some product sequences as well.
I've tried a few different versions of dicom_hdr as well, always with the same result
My workaround is just to leave out "-m1" and let it scan the entire file, but I'd really like to be able to speed up my scripts by telling grep to exit after the first match.
Any thoughts on how I can address this?
Thanks!
-Keith