regular expresion question


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers regular expresion question
# 1  
Old 09-13-2004
regular expresion question

I receive windows files via the internet on my solaris server. Since unix doesn't handle blanks well I change the blanks to ? which works just fine. I take these files and ftp them to windows so our analysts can work with them. Recently I received a file with the following structure:

/xxxxx/xxxxx/xxxxx/name_fn_894983489 #2 name2.csv

my shell converted that to:

/xxxxx/xxxxx/xxxxx/name_fn_894983489?#2?name2.csv

and my ftp failed. Actually it didn't but the way I get the file from the server it comes in on to the server my shell is running on is:

rsh cat file.name > localfile

and the cat failed. However when I tried to cat or ls it on the server it resided on it worked. But when I tried to cat or ls it with a rsh it couldn't find the file. That # sign looked questionable so I looked into it and it looks like I'm probably telling it to suppress two bytes of the name.

So my question is does the rsh cause the # sign to resolve whereas if I'm on the server it won't? Does anyone know how this works?
# 2  
Old 09-13-2004
I think having the "#" character there is dodgy because the shell is probably treating the end of the filename as a comment.

I'd also advise against using a "?" as a "regular" character, seeing as it's a shell wildcard - that will end up causing problems somewhere down the line too. Use an underscore instead.

Cheers
ZB
# 3  
Old 09-13-2004
By using the ? mark there I can get away with having spaces in a name as the system looks for anything there. I don't actually rename the files.
# 4  
Old 09-13-2004
Quote:
I receive windows files via the internet on my solaris server. Since unix doesn't handle blanks well I change the blanks to ? which works just fine. I take these files and ftp them to windows so our analysts can work with them.
FYI Windoze does not understand ? or any special characters
in the names of a file. In case you are putting a ? in the name of a file and FTP it you can (as JazzyBob suggested) place an underscore in the name of the file as against a ?

Cheers
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String search using Regular Expresion

Hi, I am getting a string in the file, I want to parse the srting and extract the percentage from the string. Sample string are - ASAD112_sd12.34%adnmfk ASAsds_1.34%adnmfk ASAdf 2 sd12.34%adnmfk ASAD112_sd 12.34% adnmfk ASAD112_sd12.34% adnmfk I want to extract the numeric value... (3 Replies)
Discussion started by: meetvipin
3 Replies

2. Shell Programming and Scripting

Help on the regular expresion =~

my $hw_plf_desc = `grep hw_platform $NODE_CFG_FILE`; if($hw_plf_desc =~ /Netra X4270 X4446A M2 /) Could someone explain the use of =~ .... this works only for perl . What is the alternate for the same in shell . Could any one convert this to shell script (7 Replies)
Discussion started by: frintocf
7 Replies

3. Shell Programming and Scripting

Regular Expressions question

Hi I have a multiple line file in the following format: .... 1095 1000 0011 0000 1000 0101 0100 1100 1111 1096 1000 0011 0000 1000 0101 0100 1100 1111 1111 1000 0011 0010 1000 1001 0100 1100 1101 1112 1000 0011 0000 1000 0001 0100 1100 ... (11 Replies)
Discussion started by: aoussenko
11 Replies

4. Shell Programming and Scripting

KShell regular expresion

Hi, I would like to know if the parameter i am passing to a shell script is contain the following charachter : ASM. I belive that i should use regular expresion here. Can one help ? Bellow is the "if statment" i need to fix with the reg exp: if ; then #echo "IT IS AN RDBMS... (4 Replies)
Discussion started by: yoavbe
4 Replies

5. Shell Programming and Scripting

Regular expresion

Here's my script read number if echo $number | grep "" I want this "if" statement to return true only when numbers without letters is matched. For example 45 - true, 923 - true, r5 - false, tg/f - false and so on. In this script even a single digit number like "3" returns false. Thanks. (1 Reply)
Discussion started by: eXPlosion
1 Replies

6. Shell Programming and Scripting

help in if expresion

Hi All, Is my script still error?? i try to running and still error?? need help (1 Reply)
Discussion started by: justbow
1 Replies

7. UNIX for Dummies Questions & Answers

Question on Regular Expression

Folks; Could some one tell me what these 2 regular expressions mean: */(*)/* (\d\d\d\d/\d\d/\d\d/*?) (14 Replies)
Discussion started by: Katkota
14 Replies

8. Shell Programming and Scripting

Regular expression question

hi i need to wipe out something from giving path i have some thing like that : pwd | sed 's/.*foo//' it is working fine when I have path like : /blah/balh1/foo/moo so it erasing me all that comes before the foo including the foo but I have problem when I have dir by the name of... (7 Replies)
Discussion started by: umen
7 Replies

9. Shell Programming and Scripting

Variable regular expresion in awk.

:confused: Is there any way to use in awk a regular exprexion with a format not previusly known? I mean something like /VAR/ ,obviously VAR is the variable exprexion. Thak you all in advance. (4 Replies)
Discussion started by: Klashxx
4 Replies

10. UNIX for Dummies Questions & Answers

Regular Expression Question

Hi - I am trying to ignore the following items from a list. lp0 lp11 lp12 lp14 The following code works fine, but I was wondering if there was a tidier way to write the lp regular expression? egrep -v "lp" Thanks in advance. (3 Replies)
Discussion started by: Krispy
3 Replies
Login or Register to Ask a Question