untitled
viviti

Extract  

What is Extract?

Extract is a ASCII file tailor. The program reads in the directive informations from script file and tailors Extract File(source) to individual needs specified by directives. And prints out the resault to output file.


how to use Extract?     goto top

The standard manner used to invoke is:

1:ExTract ExTract_File Script_File OutPut_File
2:ExTract ExTract_File -[XX]f|F|n|N:Compare-text [-[YY]x|X:Compare-text] OutPut_File

  • 1:If Param. 2 use -f|F:Compare-text format, Program will uses Compare-text to compare every lines of the input file. In case of match found, the line will print to OutPut_File.
    If Param. 2 use -n|N:Compare-text format, Program will uses Compare-text to compare every lines of the input file. In case of match not found, the line will print to OutPut_File.
    If XX was previdedĦA means column number was specifial as XX(First column is 1).
    If Param. 3 uses -[YY]x|X:Compare-text formatĦAProgram will print or not print, ĦAfrom find out Parm. 2 until Parm. 3.

  • 2:If Parm. 2 is a script file name, program will read every script line from the script file.

  • Commands parses policy for script file:
              1:First non-blank character if less than char. 'A' will be treated
                as a comment line.
              2:First word must by a command and following is(are) parameters.
              3:Command and parameters were separated from by blank,',' and Tab.
              4:In case of parameter has blank or start by special char.
                This parameter can use a less than 'A' char. as a Quotation mark*
              5:0~9,*,+,-,blank,tab,',' char. have special meaning, can not be a
                Quotation mark.
                Ex. command 'This is first parameter' ^This is sec. par.^


  • 3:Return ERRORLEVEL value
  • 0 Normal return
    1
    Directive location mismatch error
    2 Directive name error
    5 Search empty file error

    Ex.
    Extract Source.txt "-n:2006-03-09" NotOutPut.txt
    List all the lines in Source.txt that does not has string "2006-03-09" and output to file NotOutPut.txt.

    Extract Source.txt -f:steam -x:others FindOut.txt
    List all the lines in Source.txt that from the line has string "steam" until the line has string "others" and output to file FindOut.txt.

    Extract Source.txt script.txt OutPut.txt
    Read in all the directive from script.txt. Extract the string informations from source.txt defines by the directive, and output to Output.txt file.


    Script File Directives     goto top

    Comm1 "comment message"     goto top

    Print out the Comment message with a new line.


    Comm2 "comment message"     goto top

    Print out the Comment message.


    Extra0 Text Line_No Column Length [+] [split]     goto top

    Print Text and Extract the string in file ExTract_File the line number = line no., column number = column no, and string length = length.

    [+] parameter was used for loop mode. All script command between 'Loop' and 'Loopend', in case of '+' was presend, means line number will increate loop_step per Loop.

    [split] Specified the special output for extract string.

    format:
    [l|L|r|R]XYYYY  or
    [d|D|e|E|m|M|n|N|p|P]

    Split specifies print out until 'X' chr. was found + YYYY only. If [r|R] was specified, search will starts from right to left. Default,or specified 'r' and 'l', means print out extrcat string until this location. Used 'R' or 'L' means from this location, start to print out the extract string until end of extract string..
    (first chr. of YYYY may use +/-) In case of YYYY='0', means print out 'X' chr. also.

    Ex.
    loop
    word3 1 2 + r-0
    loopend
    ***
    from line 1, fatch every second word, and print the word till last '-' char.(include).

              Following functions suppose that the message is a full path file name:
                  If [d|D] was specified, device name was returned.
                  If [e|E] was specified, file extension name was returned.
                  If [m|M] was specified, with extnesion file name was returned.
                  If [n|n] was specified, with out ext. file name was returned.
                  If [p|P] was specified, path name was returned.

    Extra1 Text Line_No Column Length [+] [split]     goto top

    Print Text and Extract the string in file ExTract_File the line number = line no., column number = column no, and string length = length with new line.


    Colum0 Line_No Column Length [+] [split]     goto top

    Print the Extract string in file ExTract_File the line number = line no., column number = column no, and string length = length.


    Colum1 Line_No Column Length [+] [split]     goto top

    Print the Extract string in file ExTract_File the line number = line no., column number = column no, and string length = length with ',' was folowing.


    Colum2 Line_No Column Length [+] [split]     goto top

    Print the Extract string in file ExTract_File the line number = line no., column number = column no, and string length = length with 'Tab' was folowing.


    Colum3 Line_No Column Length [+] [split]     goto top

    Print the Extract string in file ExTract_File the line number = line no., column number = column no, and string length = length with 'new line' was folowing.


    Word0 Line_No Word_No [+] [split] [ID...]     goto top

    Print the Extract string in file ExTract_File the line number = Line_No, word number = Word_No.

      ID : add result into Register(s)[ID](0<ID<21) also.


    Word1 Line_No Word_No [+] [split] [ID...]     goto top

    Print the Extract string in file ExTract_File the line number = Line_No, word number = Word_No with ',' was folowing.

      ID : add result into Register(s)[ID](0<ID<21) also.


    Word2 Line_No Word_No [+] [split] [ID...]     goto top

    Print the Extract string in file ExTract_File the line number = Line_No, word number = Word_No with 'Tab' was folowing.

      ID : add result into Register(s)[ID](0<ID<21) also.


    Word3 Line_No Word_No [+] [split] [ID...]     goto top

    Print the Extract string in file ExTract_File the line number = Line_No, word number = Word_No with 'new line' was folowing.

      ID : add result into Register(s)[ID](0<ID<21) also.


    Split 'String' split     goto top

    Print partial String of 'String'.


    Copy First_Line No_of_Lines     goto top

    Copy No_of_Lines lines in file ExTract_File from the line Line_No.


    Copycsv First_Line No_of_Lines     goto top

    Copy No_of_Lines lines in file ExTract_File from the line Line_No and outputs word by word with EXCEL csv format.


    Copycsvx First_Line No_of_Lines     goto top

    Copy No_of_Lines lines in file ExTract_File from the line Line_No and outputs word by word with EXCEL csv format with merge first two column by a blank as first column output.


    HTMLTable First_Line No_of_Lines     goto top

    Copy No_of_Lines lines in file ExTract_File from the line Line_No and outputs in HTML format.


    Loop loop_count loop_step(one level only)     goto top

    Set loop start flag.
      loop_count loop count.
      loop_step increate number of line(s) per loop step.


    Loopend     goto top

    Set end of loop flag.

    If length/No_of_Lines/loop_count <=0 means loop until end of file. All script command between 'Loop' and 'Loopend'.
    in case of '+' was presented for the directive has '+' parameter, means line number will increate loop_step per loop.


    MatchList Start-string End-string [XX] [YY] [L]     goto top

    Find out the Start-string and print all lines until end-string was found.
      If XX was specified, means compare start string at column XX, '0' or '' means no specified.
      If YY was specied, means compare end string at column YY.
      If L was specified, means loop until end of file.


    MatchDump string1 string2 string3 ... string20     goto top

     print all lines  have  'string1~20', 'string2', .. , 'string20'.


    MatchDo string XX Directive column|word_no...     goto top

    Find out the line has 'string', then 'Do' the following directive
      string: Compare string.
      If XX was specified, means compare start string at column XX, '0' or '' means no specified.
      Directive: may ColumX, ExtraX, WordX etc...

    *** Parameter line_no will be insert by program.(specified all param. except line_no.)

    Ex. MatchDo FindMe 0 word3 3
        -- find out the line have 'FindMe', and print the 3th word of the line.

    Special Directive for MatchDo:

    ListNo String1, String2[, L|l]

    List the line number with string1 and string2. (print String1+Line_No+String2.)
    If [L|l] was specified, means loop until end of file.

    Ex. MatchDo  FineMe  ''  ListNo  'Found at Line >'  '<'
    -- find out the line have 'FindMe', and print the line No. with strings.


    WordMatchDo Line_No Word_No string Command column|word_no...     goto top

    If specified word location has 'string', then 'Do' the following command.


    Find String [XX]  [YY] [Z]    goto top

    Print all the lines in case of they has 'String'.
      If XX specified, means compare string at column XX.

      If YY specified, means print  YY lines(default = 1 line).

      If Z   specified, means print YY lines at one line.


    Not String [XX] [YY] [Z]     goto top

    Print all the lines in case of they has not 'String'.
      If XX specified, means compare string at column XX.

      If YY specified, means print  YY lines(default = 1 line).

      If Z   specified, means print YY lines at one line.


    Count String [XX] [follow] [ID...]     goto top

    Print Count No. of the lines have 'String'.
      If XX specified, means compare string at column XX.

      follow string follows also., Before print out, follow string was converted by special convert routine(detail as follow).

      ID : add result into Register(s)[ID](0<ID<21) also.


    Value value-name [follow]     goto top

    Print Form Input Value of Web page.

      follow string followsalso., Before print out, follow string was converted by special convert routine(detail as follow).


    Year [shift-minute|*], [2|4], [follow]     goto top

    Print current year number.
      shift-minute sfiht minutes from current time.
      * use last time specified.
      2|4 print out 2 or 4 digits for the chinese year.

      follow string followsalso., Before print out, follow string was converted by special convert routine(detail as follow).


    CYear [shift-minute|*], [2|3], [follow]     goto top

    Print chinese year number.
      shift-minute sfiht minutes from current time.
      * use last time specified.
      2|3 print out 2 or 3 digits for the year.

      follow string followsalso., Before print out, follow string was converted by special convert routine(detail as follow).


    Month [shift-minute|*], [follow]     goto top

    Print month number.
      shift-minute sfiht minutes from current time.
      * use last time specified.

      follow string follows also., Before print out, follow string was converted by special convert routine(detail as follow).


    Day [shift-minute|*], [follow]     goto top

    Print day number.
      shift-minute sfiht minutes from current time.
      * use last time specified.

      follow string followsalso., Before print out, follow string was converted by special convert routine(detail as follow).


    Hour [shift-minute|*], [follow]     goto top

    Print hour number.
       shift-minute sfiht minutes from current time.
       * use last time specified.

      follow string follows also., Before print out, follow string was converted by special convert routine(detail as follow).


    Minute [shift-minute|*], [follow] [X]    goto top

    Print minute number.
       shift-minute sfiht minutes from current time.
       * use last time specified.

      follow string followsalso., Before print out, follow string was converted by special convert routine(detail as follow).

       If  0<=X<=9 means print 'Minute - (Minute mod X)'

       else specified X means print first digit only.


    Register Set|Add|Sub|Mul|Div ID [Value]   goto top

    Register RAdd|RSub|RMul|RDiv ID IDX

    Register WAdd|Wstrln|WSub|WMul|WDiv ID Line_No Word_No [+]

    Register print ID [String] [Format f|F]

    Register function keep a double value as counter.

        Set Set Register(ID) = (double)Value.
        Add Set Register(ID) += (double)Value.
        Sub Set Register(ID) -= (double)Value.
        Mul Set Register(ID) *= (double)Value.
        Div Set Register(ID) /= (double)Value.

        RAdd Set Register(ID) +=Register(IDX).
        RSub Set Register(ID) -= Register(IDX).
        RMul Set Register(ID) *= Register(IDX).
        RDiv Set Register(ID) /= Register(IDX).

        WAdd Set Register(ID) += (double)Word.

        WStrln Set Register(ID) += (double)strlen(Word).
        WSub Set Register(ID) -= (double)Word.
        WMul Set Register(ID) *= (double)Word.
        WDiv Set Register(ID) /= (double)Word.

        Print Register(ID) follows by [String].

        ID Register ID, must be from 1 to 20. (They are 20 registers available)

        Format define print format for Register(ID) value. (Default will print as integer)

        f|F Define print Format is floating point
        Line_No    Line number of The word location
        Word_No  Word number of The word location

        The word was extracted from the location Line_No, Word_No.

        + Specify in looping cycle, line no. will increase automatically.


    Prompt [Prompt String] [follow String]     goto top

    Prompt function Print Prompt String with '>' on stdout device, Then Read in String from stdin. The String will print out on output file with follow String.

      follow string follows also., Before print out, follow string was converted by special convert routine(detail as follow).



    WordMatchDump Line_No Word_No     goto top

    WordMatchnotDump Line_No Word_No

    WordMatchDump function Dump Lines for the word Match.
    WordMatchNotDump function Dump Lines for the word not Match.


        The word was extracted from the location Line_No, Word_No.
        Line_No Line number of The word location.
        Word_No Word number of The word location.


    Follow string parameter convert      goto top

    Before follow string was print out, it was converted by special convert routine. All 'convert from' string was changed as 'convert to' character.


    convert from description convert to
         /b   or   \b     Back-slash sign                   \
         /s   or   \s     Slash sign                        /
         /d   or   \d     '\n'                       .
         /n   or   \n     '\n'               .
         /a   or   \a    Line-break (0X0A)                  .
         /xFF   or   \xFF     Hex value                     0xFF






    Web Hosting · Blog · Guestbooks · Message Forums · Mailing Lists
    Easiest Website Builder ever! · Build your own toolbar · Free Talking Character · Email Marketing
    powered by a free webtools company bravenet.com