[Freesurfer] End-of-line detection in text file
Hi, After editing a text file holding the b vecs to be supplied as input to dt_recon this tool did not interpret the text file correctly. It turned out that dt_recon did not recognise the end-of line character in this file: this was decimal code 13 (called CR). It seems that dt_recon only accepts decimal code 10 (called LF). Is it possible to change dt_recon? I'm on a Mac, OSX 10.6.8. Cheers, Ed ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Re: [Freesurfer] End-of-line detection in text file
On 11/9/11 07:59 , Ed Gronenschild wrote: After editing a text file holding the b vecs to be supplied as input to dt_recon this tool did not interpret the text file correctly. It turned out that dt_recon did not recognise the end-of line character in this file: this was decimal code 13 (called CR). It seems that dt_recon only accepts decimal code 10 (called LF). Is it possible to change dt_recon? What did you use to edit the b-vec file? Different operating systems use different end-of-line (EOL) conventions on text files: Windows: crlf Old-style (and largely depreciated) Mac: cr Unix (including Mac and Linux): lf My guess is that you might have used a (possibly old) Mac-based editor to edit your file. Often such editors have the option to save as UNIX format. Choose that. It's not necessary to change 'dt_recon'. Simply convert your old-style Mac cr text file to a new style lf file with: sed s/x0d/x0a/ old-b-vec-file new-b-vec-file This replaces the '0x0d' (10 in hex) characters in the file with '0x0a' (13 in hex). For more details, see: http://www.peterbenjamin.com/seminars/crossplatform/texteol.html -- Rudolph Pienaar, M.Eng, D.Eng / email: rudo...@nmr.mgh.harvard.edu MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging 149 (2301) 13th Street, Charlestown, MA 02129 USA ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Re: [Freesurfer] End-of-line detection in text file
Hi Rudolph, I used TextEdit. On a Mac with OS version earlier than OS10.6 this problem didn't occur. With TextEdit it is not possible to save as UNIX format. Thanks for the trick to use sed. Ed On 9 Nov 2011, at 15:27, Rudolph Pienaar wrote: On 11/9/11 07:59 , Ed Gronenschild wrote: After editing a text file holding the b vecs to be supplied as input to dt_recon this tool did not interpret the text file correctly. It turned out that dt_recon did not recognise the end-of line character in this file: this was decimal code 13 (called CR). It seems that dt_recon only accepts decimal code 10 (called LF). Is it possible to change dt_recon? What did you use to edit the b-vec file? Different operating systems use different end-of-line (EOL) conventions on text files: Windows: crlf Old-style (and largely depreciated) Mac: cr Unix (including Mac and Linux): lf My guess is that you might have used a (possibly old) Mac-based editor to edit your file. Often such editors have the option to save as UNIX format. Choose that. It's not necessary to change 'dt_recon'. Simply convert your old-style Mac cr text file to a new style lf file with: sed s/x0d/x0a/ old-b-vec-file new-b-vec-file This replaces the '0x0d' (10 in hex) characters in the file with '0x0a' (13 in hex). For more details, see: http://www.peterbenjamin.com/seminars/crossplatform/texteol.html -- Rudolph Pienaar, M.Eng, D.Eng / email: rudo...@nmr.mgh.harvard.edu MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging 149 (2301) 13th Street, Charlestown, MA 02129 USA The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Re: [Freesurfer] End-of-line detection in text file
On 11/9/11 09:36 , Ed Gronenschild wrote: Hi Rudolph, I used TextEdit. On a Mac with OS version earlier than OS10.6 this problem didn't occur. With TextEdit it is not possible to save as UNIX format. Thanks for the trick to use sed. Ed I'm not a great fan of the built in 'TextEdit'. That having been said, did you check under its preferences and make sure that it is setup as 'plain text' and not 'rich text'? I just tested on my TextEdit (Lion, 10.7.2) and it saved in lf and not cr convention. You might try 'aquamacs' on the Mac... assuming you're an emacs-ish type person. It works reasonably well. Another editor is TextWrangler (available in the Mac OSX App Store for free). If you look in its preferences, under Text Files there is an explicit option to save as Classic Mac, UNIX, or Windows. The default is UNIX. Oh, and make sure that the 's/x0d/x0a/' are enclosed in single quotes. I see that my copy-paste in the earlier email somehow lost the quotes. If you have a file called file1.txt and want to do the cr/lf sub and save to file2.txt, the exact command is sed 's/0xd/xoa/' file1.txt file2.txt HTH -- Rudolph Pienaar, M.Eng, D.Eng / email: rudo...@nmr.mgh.harvard.edu MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging 149 (2301) 13th Street, Charlestown, MA 02129 USA ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Re: [Freesurfer] End-of-line detection in text file
On 11/9/11 09:49 , Rudolph Pienaar wrote: sed 's/0xd/xoa/' file1.txt file2.txt sed 's/0xd/x0a/' file1.txt file2.txt Oops... critical typo. -- Rudolph Pienaar, M.Eng, D.Eng / email: rudo...@nmr.mgh.harvard.edu MGH/MIT/HMS Athinoula A. Martinos Center for Biomedical Imaging 149 (2301) 13th Street, Charlestown, MA 02129 USA ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.