Kapz Posted November 7, 2005 Share Posted November 7, 2005 I am trying to create an array from a large txt file using the following delimiter "./" however, the array breaks up the txt file every time it comes across a single "/" rather than the combination of a period and slash as I specified. Is there a particular syntax that I should be using for such a delimiter such as "." & "/" ?? Link to comment Share on other sites More sharing options...
MHz Posted November 7, 2005 Share Posted November 7, 2005 Can you show your SrimgSplit() line that you are using? Link to comment Share on other sites More sharing options...
Kapz Posted November 7, 2005 Author Share Posted November 7, 2005 Can you show your SrimgSplit() line that you are using?It also looks like it splits the file by periods and empty lines as well (although I thought the Stringreplace function got rid of those) $41 = Stringreplace($map41,@CRLF,' ') $41 = StringSplit($41, "./")This is part of the txt file:./09031-01:total 6drwxrwxrwx 3 test bti 512 Nov 3 09:16 Language/drwxrwxrwx 3 test bti 512 Nov 3 10:17 MotAttDC/drwxrwxrwx 3 test bti 512 Nov 3 10:01 languageDC/./09031-01/Language:total 2drwxrwxrwx 5 test bti 512 Nov 3 10:37 11%03%05@09:16/./09031-01/Language/11%03%05@09:16:total 6drwxrwxrwx 2 test bti 512 Nov 3 09:33 2/drwxrwxrwx 2 test bti 512 Nov 3 09:43 3/drwxrwxrwx 2 test bti 512 Nov 3 09:58 4/./09031-01/Language/11%03%05@09:16/2:total 62926-rw-rw-rw- 1 test bti 223048 Nov 3 09:33 config-rw-rw-rw- 1 test bti 27847456 Nov 3 09:32 e,rfhp0.1Hz-rw-rw-rw- 1 test bti 1997600 Nov 3 09:22 e,rfhp1.0Hz,COH-rw-rw-rw- 1 test bti 1997600 Nov 3 09:33 e,rfhp1.0Hz,COH1-rw-rw-rw- 1 test bti 88744 Nov 3 09:21 hs_file Link to comment Share on other sites More sharing options...
Kapz Posted November 7, 2005 Author Share Posted November 7, 2005 This is what it produces, I used "-" and a return space to seperate each individual array: expandcollapse popup- - 09031-01: total 6 drwxrwxrwx 3 test bti 512 Nov 3 09:16 Language - drwxrwxrwx 3 test bti 512 Nov 3 10:17 MotAttDC - drwxrwxrwx 3 test bti 512 Nov 3 10:01 languageDC - - - 09031-01 - Language: total 2 drwxrwxrwx 5 test bti 512 Nov 3 10:37 11%03%05@09:16 - - - 09031-01 - Language - 11%03%05@09:16: total 6 drwxrwxrwx 2 test bti 512 Nov 3 09:33 2 - drwxrwxrwx 2 test bti 512 Nov 3 09:43 3 - drwxrwxrwx 2 test bti 512 Nov 3 09:58 4 - - - 09031-01 - Language - 11%03%05@09:16 - 2: total 62926 -rw-rw-rw- 1 test bti 223048 Nov 3 09:33 config -rw-rw-rw- 1 test bti 27847456 Nov 3 09:32 e,rfhp0 - 1Hz -rw-rw-rw- 1 test bti 1997600 Nov 3 09:22 e,rfhp1 - 0Hz,COH -rw-rw-rw- 1 test bti 1997600 Nov 3 09:33 e,rfhp1 - 0Hz,COH1 -rw-rw-rw- 1 test bti 88744 Nov 3 09:21 hs_file - - 09031-01: total 6 drwxrwxrwx 3 test bti 512 Nov 3 09:16 Language - drwxrwxrwx 3 test bti 512 Nov 3 10:17 MotAttDC - drwxrwxrwx 3 test bti 512 Nov 3 10:01 languageDC - Link to comment Share on other sites More sharing options...
BigDod Posted November 7, 2005 Share Posted November 7, 2005 I do not know if it makes any difference but I notice that the example in the help file shows substring delimiters inside single quotes instead of double (ie './' ). Worth a try. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
MHz Posted November 7, 2005 Share Posted November 7, 2005 Check out the 3rd parameter for stringSpilt() [optional] If flag is 0 (the default), then each character in the delimiter string will mark where to split the string. If flag is 1, then the entire delimiter string is needed to mark the split. Link to comment Share on other sites More sharing options...
Kapz Posted November 7, 2005 Author Share Posted November 7, 2005 Check out the 3rd parameter for stringSpilt()[optional] If flag is 0 (the default), then each character in the delimiter string will mark where to split the string. If flag is 1, then the entire delimiter string is needed to mark the split.That fixed it!It appears as though the empty lines are still there even with $41 = Stringreplace($map41,@CRLF,'') line, am I doing that incorrectly?Thanks again. Link to comment Share on other sites More sharing options...
MHz Posted November 7, 2005 Share Posted November 7, 2005 You are reading the the file line by line by array? So StringStripWhiteSpace(..,3) should help to clear the way? Big files are better line by line by most results. Link to comment Share on other sites More sharing options...
Kapz Posted November 7, 2005 Author Share Posted November 7, 2005 You are reading the the file line by line by array? So StringStripWhiteSpace(..,3) should help to clear the way?Big files are better line by line by most results.I was trying to get rid of the return space before creating the array: $41 = StringStripCR($map41) $41 = StringSplit($41, "./", 1)which produces:---------------------------------------------------------------- 09031-01: total 6 drwxrwxrwx 3 test bti 512 Nov 3 09:16 Language/ drwxrwxrwx 3 test bti 512 Nov 3 10:17 MotAttDC/ drwxrwxrwx 3 test bti 512 Nov 3 10:01 languageDC/ ---------------------------------------------------------------- 09031-01/Language: total 2 drwxrwxrwx 5 test bti 512 Nov 3 10:37 11%03%05@09:16/ ---------------------------------------------------------------- 09031-01/Language/11%03%05@09:16: total 6 drwxrwxrwx 2 test bti 512 Nov 3 09:33 2/ drwxrwxrwx 2 test bti 512 Nov 3 09:43 3/ drwxrwxrwx 2 test bti 512 Nov 3 09:58 4/ ---------------------------------------------------------------- 09031-01/Language/11%03%05@09:16/2: total 62926 -rw-rw-rw- 1 test bti 223048 Nov 3 09:33 config -rw-rw-rw- 1 test bti 27847456 Nov 3 09:32 e,rfhp0.1Hz -rw-rw-rw- 1 test bti 1997600 Nov 3 09:22 e,rfhp1.0Hz,COH -rw-rw-rw- 1 test bti 1997600 Nov 3 09:33 e,rfhp1.0Hz,COH1 -rw-rw-rw- 1 test bti 88744 Nov 3 09:21 hs_file ----------------------------------------------------------------I'm trying to get rid of those empty line breaks before I create the array.I really appreciate the help. Link to comment Share on other sites More sharing options...
MHz Posted November 7, 2005 Share Posted November 7, 2005 $41 = StringStripCR($map41) $41 = StringSplit($41, @lf, 1) Once chosen @CR is removed then you should be able to split by @lf? This will give an array by StringSplit(). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now