 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Shalow Guest
|
Posted: Tue Jul 01, 2008 6:35 pm Post subject: |
|
|
| totana wrote: | try this: | Code: | f1= File.csv
f2 = NewFile.csv
filedelete, %F2%
loop,read,%F1%
{
stringsplit,BX,A_LoopReadLine,`,
fileappend, %bx1%`,%bx2%`,%bx4%`n, %F2%
}
|
(tested) |
when i test this, in some cases, i get a break at the end of the file, because of the break after bx4, and if i don't put the break, the lines get all tangled up
what do i do ? |
|
| Back to top |
|
 |
Shalow Guest
|
Posted: Tue Jul 01, 2008 6:53 pm Post subject: |
|
|
Ok, the error was not in this script, but the other one :
| Code: | TXT_Replace(TextFile, SearchText, ReplaceText=""){
Original := A_BatchLines
SetBatchLines, -1
TextFile := (SubStr(TextFile,1,1)="!") ? (SubStr(TextFile,2),OW=1) : TextFile
FileRead, Str, %TextFile%
StringReplace, Output, Str, %SearchText%, %ReplaceText%, All
If OW {
FileDelete, %TextFile%
FileAppend, %OutPut%, %TextFile%
}
Else {
SplitPath, TextFile,, Dir, Ext, Name
FileDelete, % Dir "\" Name "_copy." Ext
FileAppend, %OutPut%, % Dir "\" Name "_copy." Ext
}
SetBatchLines, %Original%
} |
this duplicate remover is not perfectly working because it adds an extra line if there are no duplicates in the file. |
|
| Back to top |
|
 |
Shalow Guest
|
Posted: Tue Jul 01, 2008 7:24 pm Post subject: |
|
|
| totana wrote: | try this: | Code: | f1= File.csv
f2 = NewFile.csv
filedelete, %F2%
loop,read,%F1%
{
stringsplit,BX,A_LoopReadLine,`,
fileappend, %bx1%`,%bx2%`,%bx4%`n, %F2%
}
|
(tested) |
the thing is, if i do this twice in a row for two different files, the last line of the first file is appended to the second file, even thought i specified different variables, f3, f4 and f1, f2
anyone know why ? |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 1186 Location: switzerland
|
Posted: Tue Jul 01, 2008 8:56 pm Post subject: |
|
|
I didn't tested , but I think the variable should be empty in the loop before reading
| Code: | loop,read,%F1%
{
BX1=
BX2=
BX3=
BX4=
stringsplit,BX,A_LoopReadLine,`,
fileappend, %bx1%`,%bx2%`,%bx4%`r`n, %F2%
} |
if you use separator = > ;
| Quote: |
stringsplit,BX,A_LoopReadLine,`;
fileappend, %bx1%;%bx2%;%bx4%`r`n, %F2%
|
|
|
| Back to top |
|
 |
Shalow
Joined: 01 Jul 2008 Posts: 23
|
Posted: Tue Jul 01, 2008 9:06 pm Post subject: |
|
|
ok, thanks for the emptying, it worked.
don't understand the separator thingy. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|