-
-
Save hfs/9176883 to your computer and use it in GitHub Desktop.
| #!/usr/bin/perl -wp | |
| # | |
| # Script to wrap one bulletin in a minimal WMO message structure | |
| # | |
| # Usage: | |
| # bulletinize-file infile > outfile | |
| # or | |
| # bulletinize-file < infile > outfile | |
| BEGIN { | |
| print "\x01\x0D\x0D\n"; | |
| } | |
| s/\x0D?\n/\x0D\x0D\n/; | |
| END { | |
| print "\x0D\x0D\n\x03"; | |
| } |
Hi @engshara,
you can get Perl for Windows here: https://www.perl.org/get.html . If you don’t want to install Perl just for this purpose, the same script could also be written in other programming languages easily.
Download the script as bulletinize-file.pl and save it somewhere. Then you can run it as perl bulletinize-file.pl < inputfile > outputfile. Replace inputfile and outputfile with the actual file names. These can also be absolute paths. This way you can select the specific folder.
Line 9-11 outputs the bytes 01 0D 0D 0A before the content of the input file.
Line 12 loops over every line in the input file. It copies the line into the output, but it replaces the end of line consisting of optionally 0D and 0A with 0D 0D 0A.
Line 13-15 outputs the bytes 0D 0D 0A 03 after the input file’s contents.
plz tell me how can i run this script on windows operating system, the data for example are in this path :C:\Users\Owner\Documents\eng sharaf