RE: [U2] How keep '\' in unix/uniVerse filenames?
On Tue, 2004-06-15 at 01:06, Ken Wallis wrote: > Karl Pearson wrote: > > > Try putting two \\ so the escape will be used as it was meant > > to be, to > > keep special characters from being treated like special characters. > > > > I.e. \* \? \\ etc. > > The difficulty is in doing this. Once the shell has the value with the '\' > in it, it becomes very hard to manipulate it. > > You might get away with doing a 'tr' or a 'sed' in between the 'find ... > -print' and the 'while read', but you'd have to be very clever with the > escaping of your escapes in the sed script or the tr strings. > One other option on Unix is the difference between " and ' quotes. To force an absolute, use 'TRAN.EXT-14320S1??\4-DF' rather than "...". Unix allows special characters and variables to be 'checked' withint double quotes, but uses strict string representation within single quotes. Karl > Cheers, > > Ken > > > LeRoi Keiller wrote: > > >> Cutdown example of what I'm trying to do (ksh): > >> > >> $ ls TRAN* > >> TRAN.EXT-14320S1??\4-DF > >> TRAN.EXT-14320S1??\5-DF > >> (note the '\' in the file names) > >> $ find TRAN* -print | while read file > >> do > >>ls -l $file" > >> done > >> TRAN.EXT-14320S1??4-DF not found --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] How keep '\' in unix/uniVerse filenames?
Karl Pearson wrote: > Try putting two \\ so the escape will be used as it was meant > to be, to > keep special characters from being treated like special characters. > > I.e. \* \? \\ etc. The difficulty is in doing this. Once the shell has the value with the '\' in it, it becomes very hard to manipulate it. You might get away with doing a 'tr' or a 'sed' in between the 'find ... -print' and the 'while read', but you'd have to be very clever with the escaping of your escapes in the sed script or the tr strings. Cheers, Ken > LeRoi Keiller wrote: >> Cutdown example of what I'm trying to do (ksh): >> >> $ ls TRAN* >> TRAN.EXT-14320S1??\4-DF >> TRAN.EXT-14320S1??\5-DF >> (note the '\' in the file names) >> $ find TRAN* -print | while read file >> do >>ls -l $file" >> done >> TRAN.EXT-14320S1??4-DF not found --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] How keep '\' in unix/uniVerse filenames?
Wow, the 'for F in...' works a treat, while the xargs option is a bomber. You would expect xargs would work, but nope. But thanks for the first option! -Original Message- From: Logan, David (SST - Adelaide) [mailto:[EMAIL PROTECTED] Sent: Friday, 11 June 2004 11:00 To: [EMAIL PROTECTED] Subject: RE: [U2] How keep '\' in unix/uniVerse filenames? Importance: Low Hi LeRoi, Try using something like for F in `ls TRAN*` do ls -l $F done or ls TRAN* | xargs -t -i ls -l {} Maybe the read is the offending command that is stripping the backslash as this would have to parse the data prior to presenting it to the next command. This would be a bit faster than using the find (unless you have to) Regards David Logan Database Administrator HP Managed Services 139 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Walker Sent: Friday, 11 June 2004 9:55 AM To: [EMAIL PROTECTED]; U2-Users (E-mail) Subject: Re: [U2] How keep '\' in unix/uniVerse filenames? Perhaps a command after the "do": tr "\\" "/" At 02:52 PM 6/10/2004, LeRoi Keiller wrote: >A number of our uniVerse files have the \ symbol in the file names. Problem >is, at unix level, these \ fellows are usually treated as 'escape' >characters and ignored or removed when you try to reference them. Eg: echo >"hello\there" displays "hellothere". > >Does anyone know how to ensure that the unix shell treats these as literal >text? Note that {}, quotes, and double-quotes don't seem to work. > >To elaborate (you can ignore this if you like)... > >Cutdown example of what I'm trying to do (ksh): > >$ ls TRAN* >TRAN.EXT-14320S1??\4-DF >TRAN.EXT-14320S1??\5-DF > (note the '\' in the file names) >$ find TRAN* -print | while read file >do >ls -l $file" >done >TRAN.EXT-14320S1??4-DF not found > >Note: The 'find' produces the correct names, but subsequent unix commands >missinterpret the meaning. Because the '\' is stripped, the ls command >tries to list D_TRAN.EXT-14320S1??4-DF instead of TRAN.EXT-14320S1??\4-DF, >and of course the file is not found. > >Any ideas? > >Thanks, >LeRoi > >LeRoi Keiller >Technical Support Consultant > --- Kent Walker - Datatel Analyst Information Technology - U.C. Hastings College of the Law 415-565-4635 --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ Disclaimer Notice This message contains privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that you must not disseminate, copy or take any action or place any reliance on it. If you have received this message in error please notify Ultradata immediately on +61 3 9291 1600. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Ultradata Australia Pty. Ltd. To unsubscribe from receiving commercial electronic messages from Ultradata Australia please email [EMAIL PROTECTED] with the subject heading "Unsubscribe". --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] How keep '\' in unix/uniVerse filenames?
Try putting two \\ so the escape will be used as it was meant to be, to keep special characters from being treated like special characters. I.e. \* \? \\ etc. Karl On Thu, 2004-06-10 at 15:52, LeRoi Keiller wrote: > A number of our uniVerse files have the \ symbol in the file names. Problem > is, at unix level, these \ fellows are usually treated as 'escape' > characters and ignored or removed when you try to reference them. Eg: echo > "hello\there" displays "hellothere". > > Does anyone know how to ensure that the unix shell treats these as literal > text? Note that {}, quotes, and double-quotes don't seem to work. > > To elaborate (you can ignore this if you like)... > > Cutdown example of what I'm trying to do (ksh): > > $ ls TRAN* > TRAN.EXT-14320S1??\4-DF > TRAN.EXT-14320S1??\5-DF > (note the '\' in the file names) > $ find TRAN* -print | while read file > do >ls -l $file" > done > TRAN.EXT-14320S1??4-DF not found > > Note: The 'find' produces the correct names, but subsequent unix commands > missinterpret the meaning. Because the '\' is stripped, the ls command > tries to list D_TRAN.EXT-14320S1??4-DF instead of TRAN.EXT-14320S1??\4-DF, > and of course the file is not found. > > Any ideas? > > Thanks, > LeRoi > > LeRoi Keiller > Technical Support Consultant > > Ultradata - Vision to Reality > +61 3 9291 1700 > www.ultradata.com.au > > > > Disclaimer Notice > This message contains privileged and confidential information intended only > for the use of the addressee named above. If you are not the intended > recipient of this message you are hereby notified that you must not > disseminate, copy or take any action or place any reliance on it. If you > have received this message in error please notify Ultradata immediately on > +61 3 9291 1600. Any views expressed in this message are those of the > individual sender, except where the sender specifically states them to be > the views of Ultradata Australia Pty. Ltd. > > To unsubscribe from receiving commercial electronic messages from Ultradata > Australia please email [EMAIL PROTECTED] with the subject heading > "Unsubscribe". > --- > u2-users mailing list > [EMAIL PROTECTED] > To unsubscribe please visit http://listserver.u2ug.org/ -- Karl L. Pearson Director of IT, ATS Industrial Supply Direct: 801-978-4429 Toll-free: 888-972-3182 x29 Fax: 801-972-3888 http://www.atsindustrial.com [EMAIL PROTECTED] --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] How keep '\' in unix/uniVerse filenames?
Hi LeRoi, Try using something like for F in `ls TRAN*` do ls -l $F done or ls TRAN* | xargs -t -i ls -l {} Maybe the read is the offending command that is stripping the backslash as this would have to parse the data prior to presenting it to the next command. This would be a bit faster than using the find (unless you have to) Regards David Logan Database Administrator HP Managed Services 139 Frome Street, Adelaide 5000 Australia +61 8 8408 4273 - Work +61 417 268 665 - Mobile +61 8 8408 4259 - Fax -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Walker Sent: Friday, 11 June 2004 9:55 AM To: [EMAIL PROTECTED]; U2-Users (E-mail) Subject: Re: [U2] How keep '\' in unix/uniVerse filenames? Perhaps a command after the "do": tr "\\" "/" At 02:52 PM 6/10/2004, LeRoi Keiller wrote: >A number of our uniVerse files have the \ symbol in the file names. Problem >is, at unix level, these \ fellows are usually treated as 'escape' >characters and ignored or removed when you try to reference them. Eg: echo >"hello\there" displays "hellothere". > >Does anyone know how to ensure that the unix shell treats these as literal >text? Note that {}, quotes, and double-quotes don't seem to work. > >To elaborate (you can ignore this if you like)... > >Cutdown example of what I'm trying to do (ksh): > >$ ls TRAN* >TRAN.EXT-14320S1??\4-DF >TRAN.EXT-14320S1??\5-DF > (note the '\' in the file names) >$ find TRAN* -print | while read file >do >ls -l $file" >done >TRAN.EXT-14320S1??4-DF not found > >Note: The 'find' produces the correct names, but subsequent unix commands >missinterpret the meaning. Because the '\' is stripped, the ls command >tries to list D_TRAN.EXT-14320S1??4-DF instead of TRAN.EXT-14320S1??\4-DF, >and of course the file is not found. > >Any ideas? > >Thanks, >LeRoi > >LeRoi Keiller >Technical Support Consultant > --- Kent Walker - Datatel Analyst Information Technology - U.C. Hastings College of the Law 415-565-4635 --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] How keep '\' in unix/uniVerse filenames?
1. Don't put them there in the first place! 2. Escape them. Wherever there's one backslash, replace it with two. ls MyFile\\WithBackslash --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] How keep '\' in unix/uniVerse filenames?
Perhaps a command after the "do": tr "\\" "/" At 02:52 PM 6/10/2004, LeRoi Keiller wrote: A number of our uniVerse files have the \ symbol in the file names. Problem is, at unix level, these \ fellows are usually treated as 'escape' characters and ignored or removed when you try to reference them. Eg: echo "hello\there" displays "hellothere". Does anyone know how to ensure that the unix shell treats these as literal text? Note that {}, quotes, and double-quotes don't seem to work. To elaborate (you can ignore this if you like)... Cutdown example of what I'm trying to do (ksh): $ ls TRAN* TRAN.EXT-14320S1??\4-DF TRAN.EXT-14320S1??\5-DF (note the '\' in the file names) $ find TRAN* -print | while read file do ls -l $file" done TRAN.EXT-14320S1??4-DF not found Note: The 'find' produces the correct names, but subsequent unix commands missinterpret the meaning. Because the '\' is stripped, the ls command tries to list D_TRAN.EXT-14320S1??4-DF instead of TRAN.EXT-14320S1??\4-DF, and of course the file is not found. Any ideas? Thanks, LeRoi LeRoi Keiller Technical Support Consultant --- Kent Walker - Datatel Analyst Information Technology - U.C. Hastings College of the Law 415-565-4635 --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] How keep '\' in unix/uniVerse filenames?
LeRoi Keiller wrote: > A number of our uniVerse files have the \ symbol in the file > names. Problem is, at unix level, these \ fellows are usually treated as 'escape' > characters Problem is there are a number of characters which have significant meaning to pretty much every shell program that you might use on UNIX and '\' is one of them. You really want to try avoiding these special characters if you need to interact with the files via a shell. > $ ls TRAN* > TRAN.EXT-14320S1??\4-DF > TRAN.EXT-14320S1??\5-DF > (note the '\' in the file names) > $ find TRAN* -print | while read file > do >ls -l $file" > done > TRAN.EXT-14320S1??4-DF not found If you just want to delete the files then rm -i TRAN* will probably work. Otherwise you may be better off setting up a VOC pointer to the appropriate directory so you can see it as a Type 19 file and process the contents in BASIC. Cheers, Ken --- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/