dbTalk Databases Forums  

Read a unix file

comp.databases.pick comp.databases.pick


Discuss Read a unix file in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Specific
 
Posts: n/a

Default Read a unix file - 08-19-2010 , 01:48 PM






How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options

Reply With Quote
  #2  
Old   
MikeYates
 
Posts: n/a

Default Re: Read a unix file - 08-19-2010 , 04:28 PM






On 19 Aug, 19:48, Specific <domp... (AT) gmail (DOT) com> wrote:
Quote:
How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options
Try preceding both ( and ) with \
A backslash means "the following character is to be taken literally"
in Unix convention.
The CHANGE() function of Databasic is useful to do that automatically.

Reply With Quote
  #3  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: Read a unix file - 08-19-2010 , 04:45 PM



MikeYates wrote:

Quote:
On 19 Aug, 19:48, Specific <domp... (AT) gmail (DOT) com> wrote:
How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options

Try preceding both ( and ) with \
A backslash means "the following character is to be taken literally"
in Unix convention.
The CHANGE() function of Databasic is useful to do that automatically.
Or (not 100% sure with CT = "COPY" to terminal") put the ID in double
quotes because this is an "TCL-II" verb.
Or use list-item /tmp 'filename(date).txt' with single quotes, or with
any other "access-class" verb.

Real solution ... don't put alphanumerics like that in filenames if
you can avoid it.

HTH
T

Reply With Quote
  #4  
Old   
frosty
 
Posts: n/a

Default Re: Read a unix file - 08-19-2010 , 04:47 PM



I'd try
ct /tmp "filename(date).txt"

--
frosty


"Specific" <dompier (AT) gmail (DOT) com> wrote

Quote:
How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options

Reply With Quote
  #5  
Old   
Specific
 
Posts: n/a

Default Re: Read a unix file - 08-19-2010 , 04:51 PM



On Aug 19, 3:47*pm, "frosty" <fros... (AT) bogus (DOT) invalid> wrote:
Quote:
I'd try
ct /tmp "filename(date).txt"

--
frosty

"Specific" <domp... (AT) gmail (DOT) com> wrote in message

news:3f6c9169-2d89-4d35-a94c-e21a8e311d50 (AT) b4g2000pra (DOT) googlegroups.com...

How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options


I think ct checks deliminates by ( so I'll have to try the list-item
method

output of \( and in quotes is filename(T not on file.

Reply With Quote
  #6  
Old   
Specific
 
Posts: n/a

Default Re: Read a unix file - 08-19-2010 , 04:58 PM



On Aug 19, 3:51*pm, Specific <domp... (AT) gmail (DOT) com> wrote:
Quote:
On Aug 19, 3:47*pm, "frosty" <fros... (AT) bogus (DOT) invalid> wrote:



I'd try
ct /tmp "filename(date).txt"

--
frosty

"Specific" <domp... (AT) gmail (DOT) com> wrote in message

news:3f6c9169-2d89-4d35-a94c-e21a8e311d50 (AT) b4g2000pra (DOT) googlegroups.com...

How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options

I think ct checks deliminates by ( *so I'll have to try the list-item
method

output of \( and in quotes is filename(T not on file.
list-item worked great, however, what if I want to delete an item with
(?
I think delete would have the same problem as CT

Reply With Quote
  #7  
Old   
Ross Ferris
 
Posts: n/a

Default Re: Read a unix file - 08-19-2010 , 09:04 PM



On Aug 20, 4:48*am, Specific <domp... (AT) gmail (DOT) com> wrote:
Quote:
How would I read a unix file with parentheses in the filename

For Example:
ct /tmp filename(date).txt

It likes to think anything after ( is options
ct /tmp "filename(date).txt"

Reply With Quote
  #8  
Old   
Brian Speirs
 
Posts: n/a

Default Re: Read a unix file - 08-20-2010 , 01:04 AM



On 19/08/2010 22:58, Specific wrote:
Quote:
list-item worked great, however, what if I want to delete an item with
(?
I think delete would have the same problem as CT
Try something like:

SELECT /tmp WITH *A0 = "[(]"
DELETE /tmp

Note you may want to refine that selection a little - that will (should)
select any item with an open parenthesis anywhere in the item-id.

I'm also going on memory for the dictionary item to use (*A0). In
Information flavours, I would now use @ID but I don't think the pure
PICK flavours have that.

Cheers,

Brian

Reply With Quote
  #9  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: Read a unix file - 08-20-2010 , 04:50 AM



Top-post follow-up to Brian's note. It seems you're using D3 so:

SELECT /tmp = "[whatever]"

We don't need *A0 for a simple query like that. And it's correct that
D3 doesn't support @ID by default, however, given a couple minutes to
play with it I believe it's easily doable.

You can also simply do the rm operation from TCL to shell out and
execute the host OS command:

!rm /tmp/filename_with_(funky?)_characters

If this is a one-shot then make use of the transparency between D3 and
the OS using "!", or with OSFI /tmp references as you're doing.

If you're doing a lot of these (for anyone reading this) then it's
inefficient to shell out for a lot of operations, and better to ! to a
single command that uses grep, pipe, and rm, all in a single command.

HTH


Brian Speirs wrote:

Quote:
On 19/08/2010 22:58, Specific wrote:
list-item worked great, however, what if I want to delete an item with
(?
I think delete would have the same problem as CT

Try something like:

SELECT /tmp WITH *A0 = "[(]"
DELETE /tmp

Note you may want to refine that selection a little - that will (should)
select any item with an open parenthesis anywhere in the item-id.

I'm also going on memory for the dictionary item to use (*A0). In
Information flavours, I would now use @ID but I don't think the pure
PICK flavours have that.

Cheers,

Brian

Reply With Quote
  #10  
Old   
Specific
 
Posts: n/a

Default Re: Read a unix file - 08-20-2010 , 01:44 PM



On Aug 20, 3:50*am, Tony Gravagno <nos... (AT) nospam (DOT) invalid> wrote:
Quote:
Top-post follow-up to Brian's note. *It seems you're using D3 so:

SELECT /tmp = "[whatever]"

We don't need *A0 for a simple query like that. *And it's correct that
D3 doesn't support @ID by default, however, given a couple minutes to
play with it I believe it's easily doable.

You can also simply do the rm operation from TCL to shell out and
execute the host OS command:

!rm /tmp/filename_with_(funky?)_characters

If this is a one-shot then make use of the transparency between D3 and
the OS using "!", or with OSFI /tmp references as you're doing.

If you're doing a lot of these (for anyone reading this) then it's
inefficient to shell out for a lot of operations, and better to ! to a
single command that uses grep, pipe, and rm, all in a single command.

HTH

Brian Speirs wrote:
On 19/08/2010 22:58, Specific wrote:
list-item worked great, however, what if I want to delete an item with
(?
I think delete would have the same problem as CT

Try something like:

* *SELECT /tmp WITH *A0 = "[(]"
* *DELETE /tmp

Note you may want to refine that selection a little - that will (should)
select any item with an open parenthesis anywhere in the item-id.

I'm also going on memory for the dictionary item to use (*A0). In
Information flavours, I would now use @ID but I don't think the pure
PICK flavours have that.

Cheers,

Brian
I have been using !rm, but I wonder if the aql method would be more
efficient.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.