This is the script. What do I need to change in order to apply it to multiple files? The eventual output files need to have the same name as the input files, but stored in a different folder (e.g. C:\Perl\Corpus\). Any help will be appreciated. Thanks!
print "Name of file (leave out...
The txt files in the folder are convered pdf files from which I want to remove the 'hard returns'. For instance:
John is walking
in the park. He is walking
with Mary.
becomes:
John is walking in the park.
He is walking with Mary.
I've written a, I admit, not-so-elegant script which works...
By browsing through the archives, I found some relevant lines:
opendir(FOLDERNAME, "[path of folder]");
@Files=grep(/\.txt/, readdir(FOLDERNAME));
close(FOLDERNAME);
foreach $file (@Files){
[specification of the command]
}
Unfortunately, it does not work so there must be some mistake in...
Hi,
I'm used to applying Perl scripts to only one file. What do I need to add to them in order to handle a complete folder in which multiple txt files are stored?
Thanks for your help!
J
Thanks mikevh,
Great feedback, I appreciate that!
>>I'd recommend that you always chomp files when reading, and put the "\n" back on when writing or
printing. Leaving the line-terminators on is almost never a good idea.
J: ok, set to automatic pilot from now on ;-)
>>Also you...
Hello,
I'm trying to retrieve the contexts of each keyword in an array. The problem is that I only get the right output for the last keyword in the array. Example:
FILE1:
tree
apple
FILE2:
This is a tree.
The aPple is green.
It looks like a tree.
should become:
**
<KEYWORD>tree...
Hi,
How do I quickly change this format:
tag
tag1
word
word1
sentence
sentence0.2
into this one:
tag tag 1
word word 1
sentence sentence 0.2
Fields are separated by tabs and after each number a newline is printed.
Thanks in advance.
J
Hi all,
Could s.o. help me in finding a script for the following task: given the two input-files 'list.txt' and 'text.txt', I need to have a script that looks for all the words (listed in the list.txt file) in the text.txt file and places them between §.
So, if list.txt is for instance:
cat...
Hello,
While working on the previous script, I encountered a new problem. Given a file ("termlist.txt") and an inputfile ("textfile.txt" --> one sentence = one line), I need to write a script that states:
If a pattern in sentence X of "textfile.txt" matches a term...
Hi,
The "premier" does not have to be changed. The idea is, irrespective of the content of the lines, to get the output as it is shown in the example above. Would it also be possible to write a (gawk) script in which you state that awk should:
1. first print "**"
2. print...
Hi,
Four files (one for Dutch, one for French, one for Italian and one for English) need to be merged into one single file.
Dutch file:
<Seg L=NL-BE>Artikel 1
<Seg L=NL-BE>Artikel 2
English file:
<Seg L=EN-GB>ART. 1
<Seg L=EN-GB>ART. 2
Italian file:
<Seg L=IT-IT>Articolo 1
<Seg...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.