PDA

View Full Version : *nix filename with VI problem



GofBorg
21-Feb-2013, 19:23
Any ideas on how to open a file named 1234-12-1234 in vi?
Can't seem to get it to interpret the dashes. I could rename it, edit it and
rename it back to what it is but seems a bit daft to do it that way.

Hspeirs
21-Feb-2013, 19:27
On 2/21/2013 12:23 PM, GofBorg wrote:
> Any ideas on how to open a file named 1234-12-1234 in vi?
> Can't seem to get it to interpret the dashes. I could rename it, edit it and
> rename it back to what it is but seems a bit daft to do it that way.
>
>

vi 1234\-\12\-1234

H.

GofBorg
21-Feb-2013, 19:45
Haitch wrote:

> On 2/21/2013 12:23 PM, GofBorg wrote:
>> Any ideas on how to open a file named 1234-12-1234 in vi?
>> Can't seem to get it to interpret the dashes. I could rename it, edit it
>> and rename it back to what it is but seems a bit daft to do it that way.
>>
>>
>
> vi 1234\-\12\-1234
>
> H.
Oooo I was so close...

vi 1234\-\12\-\1234

I see my mistake now. Thanks.

GofBorg
21-Feb-2013, 19:45
Haitch wrote:

> On 2/21/2013 12:23 PM, GofBorg wrote:
>> Any ideas on how to open a file named 1234-12-1234 in vi?
>> Can't seem to get it to interpret the dashes. I could rename it, edit it
>> and rename it back to what it is but seems a bit daft to do it that way.
>>
>>
>
> vi 1234\-\12\-1234
>
> H.
Hmmm...didn't work either.

GofBorg
21-Feb-2013, 19:48
> Haitch wrote:
>
>> On 2/21/2013 12:23 PM, GofBorg wrote:
>>> Any ideas on how to open a file named 1234-12-1234 in vi?
>>> Can't seem to get it to interpret the dashes. I could rename it, edit it
>>> and rename it back to what it is but seems a bit daft to do it that way.
>>>
>>>
>>
>> vi 1234\-\12\-1234
>>
>> H.
> Hmmm...didn't work either.

Normally in such a case I would just do vi 1234* but there are numerous
files beginning with 1234...too many to open/close.

GofBorg
21-Feb-2013, 19:55
I found the issue. Thanks for the help.

Joseph Marton
21-Feb-2013, 20:01
GofBorg wrote:

> Any ideas on how to open a file named 1234-12-1234 in vi?
> Can't seem to get it to interpret the dashes. I could rename it, edit
> it and rename it back to what it is but seems a bit daft to do it
> that way.

vi "1234-12-1234"

--
Does this washcloth smell like chloroform?

GofBorg
21-Feb-2013, 20:12
>
> vi "1234-12-1234"

That works as well. Thanks.

Jim Henderson
21-Feb-2013, 20:49
On Thu, 21 Feb 2013 19:12:41 +0000, GofBorg wrote:


>> vi "1234-12-1234"
>
> That works as well. Thanks.

Opened fine here on a Linux box without quotes or escaping any characters.

Jim



--
Jim Henderson, CNA6, CDE, CNI, LPIC-1, CLA10, CLP10
Novell Knowledge Partner

ab
21-Feb-2013, 23:47
On 02/21/2013 12:49 PM, Jim Henderson wrote:
> On Thu, 21 Feb 2013 19:12:41 +0000, GofBorg wrote:
>
>
>>> vi "1234-12-1234"
>>
>> That works as well. Thanks.
>
> Opened fine here on a Linux box without quotes or escaping any characters.

Yeah, there is nothing special about a hypen/dash in the filesystem. Use
tab-completion if nothing else, but my guess is that something about those
characters is non-standard, like they're odd hyphens that you can get from
stupid word processors... like curly-quotes that show up in nice ASCII
text files and look broken because they're non-ASCII. In that case merely
typing the hyphen directly could fail because, literally, its not the same
character. Again, tab-completion

vi 1
#then press [tab]

Good luck.

Jim Henderson
22-Feb-2013, 00:45
On Thu, 21 Feb 2013 22:47:33 +0000, ab wrote:

> On 02/21/2013 12:49 PM, Jim Henderson wrote:
>> On Thu, 21 Feb 2013 19:12:41 +0000, GofBorg wrote:
>>
>>
>>>> vi "1234-12-1234"
>>>
>>> That works as well. Thanks.
>>
>> Opened fine here on a Linux box without quotes or escaping any
>> characters.
>
> Yeah, there is nothing special about a hypen/dash in the filesystem.

Well, there's one time it's a problem - as the first character in the
filename, or (OK, two) after a space in the filename if the space isn't
properly escaped.

Jim



--
Jim Henderson, CNA6, CDE, CNI, LPIC-1, CLA10, CLP10
Novell Knowledge Partner