Non-printable Bytes in Variable Data
I am working on a shell script that generates file names
to use with bladeenc. Everything works right except that every
single music file the script creates via bladeenc has a ? or
question mark preceding the words of the title. Example: A
Christmas disk contains a song named "Joy to the World" which
comes out as a file named "?Joy to the World.mp3". I don't think
there is anything wrong with bladeenc because I can manually
produce "Joy to the World.mp3" with spaces and all by enclosing
the name of the output file in "" or double quotations. This
means my script is sneaking nulls or who knows what else in to
the variable which I called $songfilename.
Isn't there something I can do in sed along the lines of
sed '/[[0-9][a-z][A-Z ]]/p'
to pass only blanks, letters and numbers, but filter out anything
The example above is not quite what I need. It just
passes everything so what I want is to pass only what matches the
I did make the shell script print the title with an
and what it printed looked perfect. If you tell the script to
you get a blank or what looks like a blank preceding
$songfilename's output so there is most likely a null or other
non-printing character as the first one in the variable string.
If sed can be made to filter out all but alphanumerics
and spaces, it should trap what ever is causing this problem.
Thanks for any ideas. This is one of these things I think have
solved about 5 times only to see that ?at the start of the file