|
|
|
whoami
|
whoami
|
Hello. how can i read all the lines in a file using $read's regexmatch?? alias tr { .fopen -o tr test.txt | .fwrite -n tr * test1 | .fwrite -n tr * test2 | .fwrite -n tr * test3 | .fclose tr }//echo -a $read(test.txt,r,.+) * test1 
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
If you need to read every line in a file then just loop through the file with $fread: alias tr {
.fopen -no tr test.txt
if (!$ferr) {
.fwrite -n tr * test1
.fwrite -n tr * test2
.fwrite -n tr * test3
[color:red]while (!$feof) echo -s $fread(tr)[/color]
.fclose tr
}
} The red part is the code that dumps the file to your status window.
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
You can also use /filter with the g flag.
|
|
|
|
whoami
|
whoami
|
sorry but no one understood me.  i want to use match multi-lines. alias tr { .fopen -o tr test.txt | .fwrite -n tr * test1 | .fwrite -n tr * test2 | .fwrite -n tr * test3 | .fclose tr } this is for example. if i have a file contain those lines
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
Well you didn't really explain anything did you? How do you expect to be helped if you cannot even explain in proper English what you want to do exactly. (i want to use match multi-lines. <-- what kind of mambo jambo is this?)
Your code that you posted doesn't help with anything really, it just writes a few lines of text to a file. Your second post contains the exact same code but in bold, :rolleyes: as if putting it in bold is going to explain it better.
Why don't you explain with an actual example (not in coding but in words) what you want to do exactly, starting with a file that has a few lines of text, and what exactly you want to get from that file.
Going by your $read(file,r,.+) you just want to return 1 non-blank line from the text file, which you don't need a regex for by the way.
|
|
|
|
whoami
|
whoami
|
oh btw i know how to do it using /filter but i want to know how to match multi-line using $read,r
|
|
|
|
whoami
|
whoami
|
sorry for my english FOP. i'll explain it from the end. .+ this expression matches everything. ok?? try this. //echo -a $read(readme.txt,r,.+)what well happens? u'll get the first line of the readme file which is it. mIRC(R) v6.16 Internet Relay Chat Clienti want to match multi-line. sooo. when i use //echo -a $read(readme.txt,r,.+) all the lines in the readme.txt file will be echo-ed in the active window. mIRC(R) v6.16 Internet Relay Chat Client Copyright (c) 1995-2004 mIRC Co. Ltd. All Rights Reserved.
Welcome to mIRC, an Internet Relay Chat client.
mIRC attempts to provide a user-friendly interface for use with the Internet Relay Chat network. The IRC network is a virtual meeting place where people from all over the world can meet and talk.
To IRC all you need to do is Connect to a server, Join a channel, and Chat!
'til the EOF.
got it fop?? 
|
|
|
|
Joined: Sep 2005
Posts: 2,630
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,630 |
You can't. That's not what the r flag is for. Again though, if you just want to output the entire file just loop through it, there's no need for a regular expression.
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
$read returns a single line, not multiple lines.
What is preventing you from looping through the file, or using /filter with g flag like I already suggested?
You're asking for stuff that doesn't exist, while there are enough tools to do what you want already.
alias showfilter echo -a > $1 //filter -fkg <file> showfilter <regex>
You don't need a regex if all you want to do is show the contents of a file to your active window, you can simply use loadbuf:
alias showfile loadbuf $iif($active != status window,-pi $ifmatch,-spi) $$1-
|
|
|
|
whoami
|
whoami
|
well... am sorry and thank u all for your help
|
|
|
|
|
|
|
|