Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

many files can't find

by warmsuns (Initiate)
on Feb 25, 2013 at 21:30 UTC ( [id://1020577]=perlquestion: print w/replies, xml ) Need Help??

warmsuns has asked for the wisdom of the Perl Monks concerning the following question:

yao@ubuntu:~/perl$ perl abstract_extractor_by_ting 2.txt sort: open failed: words_in_SENTENCES: No such file or directory uniq: SENTENCES_words_sort: No such file or directory sh: 1: spell: not found uniq: words_in_SENTENCES_words_comb: No such file or directory sh: 1: spell: not found sort: open failed: SENTENCES_WORDS_root: No such file or directory

This is the problem I encounted ,and the following is the code where the above missing files are used

#!/site/bin/perl system("perl5 sentence_words SENTENCES ADDED_WORDS_LIST"); system("sort -f -o SENTENCES_words_sort words_in_SENTENCES"); system("uniq SENTENCES_words_sort > SENTENCES_words_sort_uniq"); system("mv SENTENCES_words_sort_uniq words_in_SENTENCES"); system("perl5 word_extract2 words_in_SENTENCES"); unlink(words_in_SENTENCES); unlink(SENTENCES_words_sort); unlink(SENTENCES_words_sort_uniq); system("spell -v +ADDED_WORDS_LIST words_in_SENTENCES_words > SENTENCE +S_err"); open(IN,"SENTENCES_err"); open(OUT,"> SENTENCES_err_list"); loop1:while(<IN>) { if (/^[+-]/) { last loop1; } print OUT $_; } close(IN); close(OUT); unlink(SENTENCES_err); system("perl5 generate_combinations words_in_SENTENCES_words SENTENCES +_err_list"); unlink(words_in_SENTENCES_words); unlink(SENTENCES_err_list); system("uniq words_in_SENTENCES_words_comb > SENTENCES_WORDS"); unlink(words_in_SENTENCES_words_comb); system("spell -v +ADDED_WORDS_LIST SENTENCES_WORDS > SUBJECT_WORDS_v") +; system("perl5 find_root SENTENCES_WORDS SUBJECT_WORDS_v"); unlink(SENTENCES_WORDS); unlink(SUBJECT_WORDS_v); system("sort -f -o SENTENCES_STEM SENTENCES_WORDS_root"); unlink(SENTENCES_WORDS_root); system("perl5 keyword_subject SENTENCES_STEM SENTENCES_words"); unlink(SENTENCES_words);

there are many commands used in the program, like "perl5 " and the two files names follows with the "sort"command ,I just can't get the meaning from these.I am studying some code written by someone else,but I have to let it run successfully and later transfer them on the windows platform. Can someone give me some useful advice:) Thank you so so much:)

Replies are listed 'Best First'.
Re: many files can't find
by tmharish (Friar) on Feb 26, 2013 at 06:41 UTC

    First off you need to note that system runs a command on your OS. This is almost a shell script.

    Your code uses the following *nix commands:

    1. sort
    2. uniq
    3. mv
    4. spell

    Additionally it runs certain Perl scripts, ( The perl5 ... bit ) and redirects the output to files that are then subsequently sorted, moved, deleted ...

    To get this to work you either need to call your other Perl programs as functions and user Perl to sort and uniq and so on OR you need to find windows equivalents to each of these commands, and make sure that they work from command line before creating a script with it.

Re: many files can't find
by karlgoethebier (Abbot) on Feb 26, 2013 at 15:08 UTC
    "...and later transfer them on the windows platform"

    Take a look at cygwin for the needed unix tools for windoz.

    Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»

      Thanks a lot ,I tried installing cygwin on my on computer ,thank you for your help:)

Re: many files can't find
by vinoth.ree (Monsignor) on Feb 26, 2013 at 04:30 UTC

    Hi warmsuns,

    Are you using
    use strict;
    use warnings;
    in your code?

    As your error message says, the script could not find the files. give the absolute path to the file names

      Are you using use strict; use warnings; in your code?
      How exactly does this help the OP? The code provided does not have problems when strict and warnings are added.
      As your error message says, the script could not find the files.
      The OP knows that:
      This is the problem I encounted ,and the following is the code where the above missing files are used
      And the gem:
      give the absolute path to the file names
      Of course that will help with:
      there are many commands used in the program, like "perl5 " and the two files names follows with the "sort"command ,I just can't get the meaning from these.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1020577]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (1)
As of 2024-04-19 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found