mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2006
Posts: 22
B
BIGZIPZ Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Feb 2006
Posts: 22
Hey guys, looking forward to your help.

Imagine you have a text file with the following line:

"Song.mp3 6.1MB"

Is there an identifier etc that can read a file and remove everything after Song.mp3, i.e. the spaces and the filename so I am left with a text file full of just Mp3 filenames on each line.


Thanks

Last edited by BIGZIPZ; 24/01/07 02:01 PM.
Joined: Aug 2004
Posts: 5
V
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
V
Joined: Aug 2004
Posts: 5
someone is going to come up with a better solution then this i know it but its worth a shot.

Code:
var %a 1
while (%a <= $lines(file.txt)) {
  .write $+(-l,%a) file.txt $gettok($read(file.txt,%a),1,32)
  inc %a 1
}


Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
If there are spaces in the filenames in the list you will need a slightly more advanced script than the one vulture offered.

Code:
alias fixfile {
  if (!$isfile($1-)) { 
    echo $color(info) -bfilrt * /fixfile: The file does not exist. 
    return
  }
  var %line = 1
  while ($read($1-,n,%line) != $null) {
    write -l $+ %line $qt($1-) $gettok($v1,1- $+ $findtok($v1,$wildtok($v1,*.mp3,1,32),1,32),32)
    inc %line
  }
}


/fixfile <file>


Link Copied to Clipboard