62 users online (1 members and 61 guests)  


  Results 1 to 3 of 3

Related

  1. extract text between two strings    Forum: PHP Forum
    Replies: 2
  2. Urgent need to sort report    Forum: CGI Perl Forum
    Replies: 2
  3. Replies: 0
  4. menu of some sort    Forum: Javascript Forum
    Replies: 2
  5. Compare ASP, PHP, CGI and XML    Forum: Website Scripts Forum
    Replies: 7
  1. #1
    AWHF's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2007
    Posts
    2

    extract, sort and compare

    i have 2 directories, "DIR_A" & "DIR_B".
    In the "DIR_A" i have many file which the name end by ".doc1" (e.g: file1.doc1, file2.doc1, ...).
    all the content in the files as follow(example):

    File1.doc1
    ::Start
    Ali Baba
    Zarul Bahrul
    Alec Foong
    Caster Lee
    ::End

    File2.doc1
    ::Start
    Calvin Lee
    Ester Foong
    Alex Wong
    Lee Kim
    ::End

    File3.doc1
    ::Start
    Jocob Lim
    Irene Chai
    ::End


    where else in "DIR_B" i have many file as well which the name end by ".doc2" (e.g: book1.doc2, book2.doc2, ...).
    all the content in the files as follow(example):

    Book1.doc2
    this is the 1st line
    this is the 2nd line
    name(Jocob)
    this is the 3rd line
    name(Lee)
    this is the 4th line
    name(Irene)
    this is the 5th line
    this is the 6th line

    Book2.doc2
    this is the 1st line
    this is the 2nd line
    name(Calvin)
    this is the 3rd line

    Book3.doc2
    this is the 1st line
    this is the 2nd line
    name(Alex)
    this is the 3rd line
    name(Ali)
    this is the 4th line
    name(Zarul)
    this is the 5th line
    this is the 6th line

    Book4.doc2
    this is the 1st line
    this is the 2nd line
    name(babu)
    this is the 3rd line
    name(malik)
    this is the 4th line
    this is the 5th line
    this is the 6th line

    I need to compare the info in all the files between "DIR_A" and "DIR_B".
    All the info are in blue color. The concept i use is to extract the info, sort it and compare. After comparing the info, i want it to save in a new file called "result".

    this is my home directory (/eng/home/assignment) where the the "DIR_A" and "DIR_B" are located.

    can anyone help me to write the script please?
    i had to for quite a long time and many way but the result is failed.
    i very new to PERL and i hope someone from here can help me.
    thank you!

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: extract, sort and compare

    This is relatively easy to do. Only problem is that the file extension is .doc and I have never tried opening a .doc file before (I usually only use PDF, txt or HTML). Maybe it will open using normal methods. I just posted a response to a similar question. Ill get the link and post it here. If you need any help with your script let me know.

  3. #3
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: extract, sort and compare

    http://www.ahfb2000.com/webmaster_he...ead.php?t=7960
    That does everything except the comparing bit, but thats not too difficult
    Chris



Tags for this Thread