AIX unix system script (need help)

This is a discussion on AIX unix system script (need help) within the Linux Programming forums, part of the Platform Specific Boards category; Im writting a script which takes two directories and displays them, then displays the contents which do not match in ...

  1. #1
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114

    AIX unix system script (need help)

    Im writting a script which takes two directories and displays them, then displays the contents which do not match in the two directories.

    I tried using the -v command in grep but it does not work properly, ill show you my current code (sorry im new to unix scripting) :

    if [ ! $# = 2 ]
    then
    echo Usage: dircomp dir-name1 dir-name2 ... 1>&2
    exit 1
    elif [ ! -d $1 ]
    then
    echo The first argument $1 is not a directory 1>&2
    exit 1
    elif [ ! -d $2 ]
    then
    echo the Second argument $2 is not a directory 1>&2
    exit 1
    else
    ls $1 -al > list
    ls $2 -al > list2
    grep -v -f list list2
    rm list
    rm list2
    exit 0
    fi

    -----
    Thanks in Advance

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,551
    Well it's off-topic

    read the manual on the comm command

  3. #3
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114

    Thumbs down

    the comm command surpresses unique lines, i dont want to, i want to show the unique lines between the two files... which are the non matching lines... and the DIFF command which can accomplish this has a problem with it, it will put '<' '>' in front of what i want to change

  4. #4
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132
    Hi,

    diff --brief directory1 directory2
    this suppresses the output of differences in files. Is this what you are looking for? If not, can you give a simple example of the output you want.

    alex

  5. #5
    Unregistered
    Guest
    check out uniq

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get the user ID and group ID from UNIX system
    By dragonfly1801 in forum Linux Programming
    Replies: 6
    Last Post: 11-16-2006, 03:45 AM
  2. Replies: 3
    Last Post: 06-13-2005, 07:28 AM
  3. Why Can't C++ Be Used to Develop Operating System?
    By Antigloss in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2005, 06:16 AM
  4. question about open file in unix system
    By wu7up in forum C Programming
    Replies: 6
    Last Post: 03-13-2003, 05:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21