Hi,
I am writing a simple script in PERL that takes the output of another program and adds the appropriate SDDS header so I can use all the functionality of the SDDS Toolkit. At first the script seems to be working. An output file is created which Windows recognizes as having an .sdds extension and a quick "sddscheck" turns out ok. However, when I try to use sddsplot (for example) I see no data. I can solve the problem by opening the file with a text editor and saving as an .sdds file. (I am asked if I want to overwrite the previous file which I do). By doing this, I can use sddsplot. While this is a fairly straightforward fix, the point of the script is to make this conversion on many files and I'd rather not have to open each file and "save as".
Any help would be greatly appreciated!
--chris
Generating SDDS files with PERL
Moderators: cyao, michael_borland
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Generating SDDS files with PERL
Chris,
Can you post one of the files that gives the problem? I suspect a problem with end-of-line characters.
--Michael
Can you post one of the files that gives the problem? I suspect a problem with end-of-line characters.
--Michael
Re: Generating SDDS files with PERL
Hi Michael,
I've attached a file.
--chris
I've attached a file.
--chris
- Attachments
-
- tmp.sdds
- (11.52 KiB) Downloaded 226 times
-
- Posts: 1951
- Joined: 19 May 2008, 09:33
- Location: Argonne National Laboratory
- Contact:
Re: Generating SDDS files with PERL
Chris,
The problem seems related to lack of new-line characters in the body of the file. For example, if I run "sdds2stream tmp.sdds -rows", it says "1 row". Also, "wc tmp.sdds" returns 22 as the number of lines---that's the header plus 1 line.
When I examine the file with "od -ba tmp.sdds", it shows that in the header you have carriage-return/line-feed at the end of each line, while in the body you have carriage-return only. So perhaps some modification of the perl code to write the body of the file the same way as the header will resolve the problem.
--Michael
The problem seems related to lack of new-line characters in the body of the file. For example, if I run "sdds2stream tmp.sdds -rows", it says "1 row". Also, "wc tmp.sdds" returns 22 as the number of lines---that's the header plus 1 line.
When I examine the file with "od -ba tmp.sdds", it shows that in the header you have carriage-return/line-feed at the end of each line, while in the body you have carriage-return only. So perhaps some modification of the perl code to write the body of the file the same way as the header will resolve the problem.
--Michael
Re: Generating SDDS files with PERL
Hi Michael,
Thanks for the suggestion. It appears that if each line in the body ends with a line-feed, then things are resolved.
--chris
Thanks for the suggestion. It appears that if each line in the body ends with a line-feed, then things are resolved.
--chris