alias mp3r {
if ($msn) {
if (!$read(Mp3Rank.txt,nw,$+(*,$msn,*))) {
write -n Mp3Rank.txt $msn : 1
return $read(Mp3Rank.txt,w,$+(*,$msn,*))
}
write $+(-l,$readn) Mp3Rank.txt $msn : $calc($gettok($read(Mp3Rank.txt,n,$msn),2,58) + 1)
}
}
Now..that will write to the file in this format:
Artist - Track : [number of times played]
And it works..until it gets four different lines in the file. Then, instead of making a new line, it appends to the last one. Anyone know what causes that, or yet ANOTHER thing I can do to work around this?
Well, /write -dw"match text" works just fine, but must be an exact match or a wildcard match, ie if there is a trailing space the line won't match that example, but would match -dw"match text*", or you could use the -r switch for a regex search. Try /write -w"This is a test*" file.txt To overwrite, you omit the d/write -w"This is a test*" file.txt Replacement text Again the exact match comes into it.