Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2008

    Unanswered: grep or a simple script?

    Hi guys,

    I use AIX Unix and would like to know if there's a simple way how to do a kind of compare between two files. Should I use some grep, find or awk?

    I have 2 text files, let's name them file1 and file2.

    What I need:

    I want to read line by line file1 - certain field or better 2 fields of the file1 and look up the information in the file2.

    To be more descriptive: I'd like to extract field1 at position 10-15 and field2 at position 25-31 from file1 and search or find if the same information is somewhere inside the file2. When no, I'd like to output the field1 & field2 off the file1 doesn't exit in file2.

    let's say file1 contains something like:

    123232 3232 2323 2323123123213 trterert

    and file2 e.g.

    123232 3232 2323 2323123123213 XXXXXXXX

    and let's say I want 123232 & trterert from file1 to be searched in file2 ==> I get an "error" because the script would find only 123232 and not trterert.....

    I'd be more than happy if someone can help me out or recommend a link or appropriate command or script.

    I just need to check some record(s) in one file - and if they're available in the other file...

    Any suggestions?

  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    Quote Originally Posted by netrom
    Should I use some grep, find or awk?
    I would use some perl. What you use will depend on what you are familiar with.
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    May 2005
    South Africa
    Provided Answers: 1
    The join command might help you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts