Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Unanswered: SubString of a file

    I am trying to get the string contained in a row/col location of a text file.

    Example
    01 02 03 04 05 06 07 08 09 00
    11 12 13 14 15 16 17 18 19 10
    21 22 23 24 25 26 27 28 29 20

    the string at row 2 col 3 length 2 is 12.

    I need to to do some script redirection according to what text is contained ina text file, i.e. what type of form the user has printed.

    I am using ksh and am open to other solutions.

  2. #2
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    may be I am wrong, but at row 2 col 3 length 2 I see the 13 and not 12.

    Please give some more examples to what you want. I dont understand the second part.
    Greetings from germany
    Peter F.

  3. #3
    Join Date
    Dec 2003
    Posts
    2
    For example I have the following text file:


    Invoice - Return Merchandise *** D U P L I C A T E ***
    000000 108560-00
    2040
    10/31/02 01-024 1
    I would like a line in the script to return a true if the word Invoice is located in row 1 colum 12. Other forms could have Quote, Purchase Order, etc... in the same location. I am to do something dfferent for each different form.

    thanks

  4. #4
    Join Date
    Dec 2002
    Posts
    104
    Originally posted by thejeffe
    For example I have the following text file:



    I would like a line in the script to return a true if the word Invoice is located in row 1 colum 12. Other forms could have Quote, Purchase Order, etc... in the same location. I am to do something dfferent for each different form.

    thanks
    hi!

    just a try to ur problem,

    i understand that at row 1 col 12 there can be values like invoice,Quote,Purchase Order,etc. and depending on these values u need to call different script/redirection(correct me if i am wrong)

    if my understanding is correct then u can extract what is contained in row1 col12 using it

    val=`awk '{ if (NR==1) print $12}' filename.txt`

    now $val contains values like Invoice/Quote/PurchaseOrder

    now u can use case on $val values and do redirection accordingly.

    hope this is what u want.
    --Pooja

Posting Permissions

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