Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004

    Unhappy Unanswered: Need help with this script! PLEEEEASE!!!

    I have a script that I dont know what it is doing. Can any one tell me what this script is doing? Please? here is the script with the lines numbered.

    1 #!usr/bin/ksh
    2 date +%m%d%y%H%M >invdte
    3 exec <invdte
    4 read dte
    5 cp /test/appl_from/810S /test/appl_from/810S-$dte.jic
    6 cp /test/appl_from/base810S /test/appl_from/A3810S
    7 cp /test/appl_from/base810S /test/appl_from/3M810S
    8 >810a.wrk
    9 sig="XX"
    10 A3=" "
    11 fil="XX"
    12 t=0
    13 usxx=0
    14 usab=0
    15 us3M=0
    16 id[300]="end"
    17 cat /test/appl_from/810S |tr "|" "11" >810a.wrk
    18 exec <810a.wrk
    19 while read a b c d e f g h i j
    20 do
    21 ((t=t+1))
    22 if test "$a" = "ENV"
    23 then
    24 echo "$g $e"
    25 if test "$h" = "X12"
    26 then sig="$g"
    27 fi
    28 fi
    29 id[$t]="$sig"
    30 done
    32 exec </test/appl_from/810S
    33 t=0
    34 while read a
    35 do
    36 ((t=t+1))
    37 fil="XX"
    38 usxx=1
    39 if test ${id[$t]} = "ABBOTT"
    40 then fil="A3"
    41 usab=1
    42 fi
    43 if test ${id[$t]} = "3M"
    44 then fil="3M"
    45 us3m=1
    46 fi
    47 echo $a >>/test/appl_from/"$fil"810S
    48 if test "$fil" = "XX"
    49 then
    50 echo "cannot assign inv for ${id[$t]}"
    51 fi
    52 done
    54 if test $usab = "1"
    55 then
    56 echo "A3 file exists"
    57 fi
    59 if test "$us3M" = "1"
    60 then
    61 echo "3M file exists"
    62 fi
    63 mv /test/appl_from/810S /test/appl_from/810S-"$dte".fil
    64 exit

  2. #2
    Join Date
    Jun 2003
    West Palm Beach, FL


    Here you will find what you need.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Oct 2004

    NEED HELP with this script

    I am not a unix person, nor do I pretend to be. This was a script that prepares invoices for EDI transmission but it doesnt work. I believe it to be becasue of the first 20 lines but I am not sure what these first 20 lines are doing. Can someone please translate this into english so us non unix users can understand what it is doing? I appreciate any help I can get.
    Thank you.

  4. #4
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    The script doesn't make a whole lot of sense to me - but here goes:

    line 2-4: obtain the current time to use later

    line 5: create a copy of /test/appl_from/810S; use the timestamp to distinguish the file name

    line 6-7: create two copies of /test/appl_from/base810S

    line 8: create an empty file called 810a.wrk


    line 17: take the file /test/appl_from/810S and replace all "|"s with "1"s; put the result into 810a.wrk

    line 19-30: look at each line of 810a.wrk; if it begins with "ENV" and there's "X12" in the 8th field save the 7th field

    line 32-52: read every line of /test/appl_from/810S; if the 7th field of that line (as saved before) is "ABBOTT" append that line to the file //test/appl_from/A3810S; if the 7th field is "3M" then append it to /test/appl_from/3M810S

    Hope this helps you...

  5. #5
    Join Date
    Oct 2004

    needs help with script.

    Yes it does help. It does make some sense. thank you for your input. I appreciate it.

Posting Permissions

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