[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: An Odd File Name



On Mon 13 Feb 2017 at 11:06:24 (-0600), Martin McCormick wrote:
> 	I downloaded a file from a site using lynx and the file
> name is "InstallingGRFromSource#Using-the-build-gnuradio-script.gz"
> Actually, the double quotes are here for clarity but the name is
> as it appears including the # sign.  Ls sees it and rm -i would
> remove it if I let it but if I do:
> 
> gunzip InstallingGRFromSource#Using-the-build-gnuradio-script.gz
> 
> or
> 
> ls InstallingGRFromSource#Using-the-build-gnuradio-script.gz
> 
> bash can't find/see the file.
> 
> I am a bit embarrassed to ask this question because I have been
> using unix for about 28 years and am well aware that certain
> characters in file names such as blank spaces cause problems but
> these are usually negated by either putting the whole file name
> in double quotes or by escaping the troublesome character with a \ or backslash.
> 
> 	While there is no whitespace character anywhere in the
> name, there are several dashes and a # sign which is probably the
> worst offender. I tried escaping the # symbol with a backslash
> with no change and then I tried escaping all the dashes with
> backslash characters as in \- and \# but commands referencing the
> file by name all come up short. I also did try the whole name in
> both single and double quotes.
> 
> 	This is a teachable moment but I am not sure what else to
> do other than remove all the other files in the directory and
> then gunzip * which might work but that's sure going about things
> the weird way rather than systematically. I did list the file by
> using ls and piped that in to a file which I then removed all
> names but the problem one and then used od -tx1 on the file name,
> piping that to less so I could see if there were any 8-bit
> characters or some other oddity, but the name was composed
> only of the letters you see.
> 
> 	By the way, gunzip does not have a -i flag like rm but
> that thought crossed my mind.
> 
> 	Since the name is long, I did make a short file with the
> command such as ls or gunzip and the file name and then I typed
> 
> source thatfile
> 
> or sh thatfile so I did not type the command directly from the
> command prompt but normally the source command is as if you did
> type on the keyboard from the prompt.
> 
> 	Any ideas for matching that name?

You could try partial wildcarding, like:

$ ls *tall*build*

and if you succeed, then do type:

$ echo *tall*build* | od --endian=big -t x1

and try to reveal what the filename actually is by hex dumping it.

If you fail to match it, then you need a blunderbuss:

$ ls -1 | od --endian=big -t x1 | less

Now search for 0a (by typing /0a at less's prompt)
and, in the company of short filenames, your long one
will be delimited by two widely spaced 0a strings.

Here is what you're checking for:

$ echo ' InstallingGRFromSource#Using-the-build-gnuradio-script.gz' | od --endian=big -t x1
0000000 20 49 6e 73 74 61 6c 6c 69 6e 67 47 52 46 72 6f
0000020 6d 53 6f 75 72 63 65 23 55 73 69 6e 67 2d 74 68
0000040 65 2d 62 75 69 6c 64 2d 67 6e 75 72 61 64 69 6f
0000060 2d 73 63 72 69 70 74 2e 67 7a 0a
0000073

Perhaps there's something embedded in the name that doesn't display.

Cheers,
David.


Reply to: