Results 1 to 3 of 3

Thread: help for script

  1. #1
    Join Date
    Jun 2004
    Posts
    46

    Unanswered: help for script

    Hi, I am trying to compare first 2 columns in a file by opening that file and after comparing if they are not equal then i should email with subject and body (should contain all the file data in the body) i am trying to do this in Universe Basic(though its not complete), as below but How can i do using shell script
    Code:
    OPENSEQ DataFile To File Else Print "File Not Found"
    READSEQ Line1 FROM File THEN 
    f1 = Field(Line1,",",1,1)
    f2 = Field(Line1,",",2,1)
    f3 = f1:",":f2
    if f1 <> f2 Then Call DSSendMail("From:Mark.jason@ford.com\nTo:Mark.jason@ford.com\nSubject:Hi ya\nBody:f3") Else ErrorCode = 0;
    END
    
    CLOSESEQ File
    Any advice or Help is appreciated.

    Thanks
    Mark.

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    here's something to start with:

    Code:
    #!/bin//ksh
    
    file='mark1.txt'
    
    typeset -i cnt=0
    while IFS=',' read c1 c2 trash
    do
       cnt=$((cnt+1))
       if [ "${c1}" != "${c2}" ]; then
          mailx -s "File: [${file}] : mismatched columns @line=${cnt}" myName@myDom
    ain.com < "${file}"
          #echo "File: [${file}] : mismatched columns @line=${cnt}"
          break;
       fi;
    done < "${file}";
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    Join Date
    Jun 2004
    Posts
    46
    Thanks a Lot,
    I feel like i need to get some time out and start learning unix..

    Thanks again for your help
    Mark.

Posting Permissions

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