I have a text file that I need to find data and assign it to a variable. I have found code to read and search a file but the information I want is not always constant. The Items in Red will change. Is there a way to find this information, maybe by position and assign it to a variable? EX.FCITC = 690.4

Sorry if I was suppose to wrap the text files with the code tags I was not sure, because it was not code.
Thanks,
Joe

Study transfer. From FMPP_EXA To FPL_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 3 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
690.4 -0.12312 - 5567 IND RIV 115 B$0029 CTAB GSU 1.00 1 Base Case 0.0 -85.0

Study transfer level - 1000.0 MW. Total violations: 21
First violation - -756.5 MW.

just bu looking at your post, i could not tell what you actualy wanted, however, here is code that will open a file and put its contents into a variable named data:

fileName = raw_input('What is the file name? ')
file = open(fileName, 'w') #'w', means if the file does not exsist, python will create a new one with nothing in it.
data = file.read() #use readlines() if you you prefer a list with each line.

hope that helped :)

#opens a test file to write data to
newfile = open("test.py", "wt")
newfile.write("TXRGP = 370.5\n")
newfile.write("GPYBN = 666\n")
newfile.write("FCITC = 690.4\n")
newfile.close()

#read the file and search for a string
#strip of any unwanted charecters
newfile = open("test.py", "rt")
for line in newfile:
    if "FCITC" in line:
        x = line[6:].strip("=")
        x = x.strip(" ")
    else:
        pass
newfile.close()
print(x)

Hope this helps.

I am not sure if I made my self clear in the previous post or maybe I just don't understand the code. The number I want is the FCITC, the Limiting Constraints and the Contingency that caused the Limiting Constraint. These variables will constantly change and therefore I can not search for them in the file so I will have to find them based on location or maybe some other method. In the example I posted these variables I would like are 690.4, 5567 IND RIV 115, AND Base Case, but if I ran this again these values will probably change. I would like to store them as variables because I would like to use them in various logic schemes and or excel files.

The format of the text files should not change. Using Ultra edit the values line up nice in columns but I am not sure what the delimiter is. This is my first post using the bb code so please let me know if it looked correct. I don't necessarily want anyone to write the code for but to tell me what functions to use would be great, although I am not against someone writing the code either it would make it easier to understand. Below is the full text file I will be using. Hopefully it looks right I tried to bold the correct Items but I am not used to this text editor.

Thanks again,
Joe
[TEX]
PSS(R)MUST 9.2 -- Managing and Utilizing System Transmission -- THU, SEP 24 2009 15:13
2008 FRCC LFDB - 90% LOAD
2009 SUMMER BASE
Case.File C:\HourlyATC\ATC090924\OPCASE12.sav
Subsys.File C:\HourlyATC\subsystem.sub
Monit.File C:\HourlyATC\monitor.mon
Contin.File C:\HourlyATC\contingency.con
Exclud.File C:\HourlyATC\exclude.exc

Study transfer level - 1000.0 MW. Total violations: 3
First violation - 690.4 MW.

Study transfer. From FMPP_EXA To FPL_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 3 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
690.4 -0.12312 - 5567 IND RIV 115 B$0029 CTAB GSU 1.00 1 Base Case 0.0 -85.0

Study transfer level - 1000.0 MW. Total violations: 21
First violation - -756.5 MW.

Study transfer. From FMPP_EXA To PEF_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 21 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
-756.5 -0.04682 0.30400 6106 I-STATE 230 6104 TENOROC 230 1 C: 7890 OSCEOLA 230 9190 AGNES-RX 230 1 415 -472.4 -437.0 -0.05872 -314.6 -270.2
Open 7890 OSCEOLA 230 9190 AGNES-RX 230 1

Study transfer level - 1000.0 MW. Total violations: 25
First violation - 589.3 MW.

Study transfer. From FMPP_EXA To TECO_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 25 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
589.3 0.08324 -0.36819 5704 TAFT 230 5710 C CENTER 230 1 C: 2883 INTERCSN 230 5352 CAN ISL 230 1 393 317.9 367.0 0.06531 173.5 212.0
Open 2883 INTERCSN 230 5352 CAN ISL 230 1

Study transfer level - 1000.0 MW. Total violations: 7
First violation - 1905.9 MW.

Study transfer. From FPL_EXA To FMPP_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 7 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
1905.9 -0.15360 -0.75247 6101 MCINTOSH 230 6104 TENOROC 230 1 C: 9100 RECKER 230 9150 LKAGNES 230 1 416 -144.2 -437.0 -0.09545 128.5 -53.4
Open 9100 RECKER 230 9150 LKAGNES 230 1

Study transfer level - 1000.0 MW. Total violations: 18
First violation - 1119.9 MW.

Study transfer. From PEF_EXA To FMPP_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 18 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
1119.9 0.10692 0.51805 2167 WINDERME 230 5701 SO WOOD 230 1 C:5353-5800 582 247.3 367.0 0.08738 114.1 212.0
Open 5352 CAN ISL 230 5800 OUCCITP1 230 1

Study transfer level - 1000.0 MW. Total violations: 910
First violation - -1121.7 MW.

Study transfer. From TECO_EXA To FMPP_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 910 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
-1121.7 -0.06399 -0.13767 467 POINSETT 230 2882 HOLOPAW 230 1 C: 351 ORANGE R 230 354 ORANGE R 500 1 200 -661.8 -590.0 -0.04773 -518.2 -464.6
Open 351 ORANGE R 230 354 ORANGE R 500 1

Study transfer level - 1000.0 MW. Total violations: 11
First violation - 1776.3 MW.

Study transfer. From IPP_REL_EXA To FMPP_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 11 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
1776.3 -0.41356 0.92486 461 CAPE K 230 5703 IND RIV 230 2 C: 461 CAPE K 230 5703 IND RIV 230 1 361 -62.4 -797.0 -0.21569 -32.6 -415.7
Open 461 CAPE K 230 5703 IND RIV 230 1

Study transfer level - 1000.0 MW. Total violations: 16
First violation - 899.9 MW.

Study transfer. From IPP_REL_EXA To FPL_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 16 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
899.9 0.05451 -0.36819 5704 TAFT 230 5710 C CENTER 230 1 C: 2883 INTERCSN 230 5352 CAN ISL 230 1 393 317.9 367.0 0.04730 173.5 216.1
Open 2883 INTERCSN 230 5352 CAN ISL 230 1

Study transfer level - 1000.0 MW. Total violations: 27
First violation - -1670.7 MW.

Study transfer. From IPP_REL_EXA To PEF_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 27 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
-1670.7 -0.03205 -0.56485 6106 I-STATE 230 6104 TENOROC 230 1 C: 2878 BARCOLA 230 6102 WEST 230 1 389 -490.5 -437.0 -0.03885 -314.6 -249.7
Open 2878 BARCOLA 230 6102 WEST 230 1

Study transfer level - 1000.0 MW. Total violations: 25
First violation - 593.8 MW.

Study transfer. From IPP_REL_EXA To TECO_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 25 violations


FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
593.8 0.08260 -0.36819 5704 TAFT 230 5710 C CENTER 230 1 C: 2883 INTERCSN 230 5352 CAN ISL 230 1 393 317.9 367.0 0.07257 173.5 216.6
Open 2883 INTERCSN 230 5352 CAN ISL 230 1
/TEX]

Ok, I think I got ya now. Yeah thats gonna take a bit better scheme all in itself to extract those variables. You are most likely going to want to take a look at the re module which I just started using myself. It allows you to setup regular expressions so you can setup patterns that it will pick up on. Some of the obvious patterns I'm seeing so far are, the first variable always starts at the beggining of your third line down. The next seems to be between a float value and the integer 230 most the time. The hard part is making sure you have setup your regular expression to account for all of these minor details. That should at least give you a direction to move in for what you are working on.

See if something like this will do, but be careful that all the slicing doesn't steal some data:

def extract_number(data_str):
    """
    extract the numeric value from a string
    (the string should contain only one numeric value)
    return the numeric part of the string or None
    """
    s = ""
    for c in data_str:
        if c in '1234567890.-':
            s += c
    if s:
        return s
    else:
        return None


def extract_between(text, sub1, sub2):
    """
    extract a substring from text between first
    occurances of substrings sub1 and sub2
    """
    return text.split(sub1, 1)[-1].split(sub2, 1)[0]


# test file
fname = "violate.dat"

mylist = []
flag = False
for line in open(fname):

    if flag == True:
        mylist.append(line)
        flag = False
    if "FCITC" in line:
        flag = True

newlist = []
for item in mylist:
    temp1 = item[:16]
    #print(temp1)  # test
    temp1 = extract_number(temp1)

    temp2 = item[35:83]
    #print(temp2)  # test
    temp2 = temp2[6:28].replace(']', ' ')
    temp2 = temp2.strip()
    #print(temp2)  # test

    temp3 = item[96:144]
    #print(temp3)  # test
    temp3 = extract_between(temp3, '[B]', '[/B]').rstrip()
    #print(temp3)  # test

    newlist.append((temp1, temp2, temp3))


print('-'*40)

for tup in newlist:
    print(tup)

"""my show -->
('690.4', '5567 IND RIV      115', 'Base Case')
('-756.5', '6106 I-STATE      230', '7890 OSCEOLA      230   9190 AGNES-RX')
('589.3', '5704 TAFT         230', ' 2883 INTERCSN     230   5352 CAN ISL')
('1905.9', '6101 MCINTOSH     230', ' 9100 RECKER       230   9150 LKAGNES')
('1119.9', '2167 WINDERME     230', '5353-5800')
('-1121.7', '467 POINSETT     230', '351 ORANGE R     230    354 ORANGE R')
('1776.3', '461 CAPE K       230', '461 CAPE K       230   5703 IND RIV')
('899.9', '5704 TAFT         230', ' 2883 INTERCSN     230   5352 CAN ISL')
('-1670.7', '6106 I-STATE      230', 'BARCOLA      230   6102 WEST')
('593.8', '5704 TAFT         230', '2883 INTERCSN     230   5352 CAN ISL')
"""
commented: nice answer! +5

I will give this a try. Also can you tell me why after your name in the Quote field their are numbers. I am new to the BBcode and I am not sure if I am doing it right. jlim699 said he had to rewrite my text file so that others could read it but I am not sure what I did wrong or how he changed it. Sorry it has taken me a while to respond this weekend was my son's 1st birthday so I was busy.
Thanks again,
Joe

Hi Ene Uran,
Looking over the code it looks like it would work, but I can't get it to run. When you open the file, which in my case would be, C:\HourlyATC\viols.lis, you don't include the path, just the name "violate.dat". How does this work? I looked up "open" and usually you would tell the command where the file is located and use a 'r' or 'w' so I am not sure how yours works. It might take me a while to go through the whole code, becaues their are a lot of functions I have never used before.
Thanks,
Joe

That is because I made a test file from your posting and put it into the working directory, the same directory the code file is in.

Since you have the real thing you can replace
fname = "violate.dat"
with
fname = r"C:\HourlyATC\viols.lis"

I figured that out, and it runs with now errors but I still can't see the results. I think it has something to do with I don't know how to run visual studio to get the output.
Joe

To put it very crudely, my code would like...

f = open("c:\\path to file\\violate.dat",'r')

chk = 0

for i in f.readlines():
if chk == 1:
val1 = i.split()[0]
print val
chk = 0

if i.find("Rating PTDF IntBase FnlBase") >= 0:
chk = 1

f.close()

Is this what u r looking for? And why are u looking for visual studio for running ur code? This should be run from the editor that comes along with python (IDLE), if u r using Windows.

Python <filename>.py if unix based.

Everything works great, except I don't totally understand. Below is the ouput I get when I use your code.

('-571.5', '4 TENOROC 230 1', 'C:9100-9120D')
('-626.4', '4 TENOROC 230 1', 'C: 7890 OSCEOLA 230 9190 AGNES-RX 230 1')
('-443.2', '4 TENOROC 230 1', 'C:9100-9120D')
('1145.8', '0 B BEND 230 1', 'C:8500-8900')
('1481.3', '1 SO WOOD 230 1', 'C:5353-5800')
('1525.8', '0 JUNEAU 230 1', 'C:8700-8400')
('1268.3', '3 IND RIV 230 2', 'C: 461 CAPE K 230 5703 IND RIV 230 1')
('681.1', '8 WYOMING 230 1', 'C: 275 MARTIN 500 476 POINSETT 500 1')
('-787.9', '4 TENOROC 230 1', ' Base Case')
('569.5', '4 TENOROC 230 1', 'C: 6105 CREWSLK 230 9050 PEBB 230 1')


I am not sure why it is different from yours except maybe the text file translation was slightly different. Can you possibly describe what is happening in the section below: I was trying to make adjustments to the code but got stuck.

for item in mylist:
    temp1 = item[:9]
    #print(temp1)  # test
    temp1 = extract_number(temp1)
 
    temp2 = item[29:79]
    #print(temp2)  # test
    temp2 = temp2[29:79].replace(']', ' ')
    temp2 = temp2.strip()
    #print(temp2)  # test
    temp3 = item[80:135]
    #print(temp3)  # test
    temp3 = extract_between(temp3, '[B]', '[/B]').rstrip()
    #print(temp3)  # test
 
    newlist.append((temp1, temp2, temp3))

Also I made a mistake, I actually need the line below after Open: for Temp 3, like shown below:

FCITC TDF LODF <--------- Limiting constraint ---------> <--------- Contingency description ---------> Ncon PreShift Rating PTDF IntBase FnlBase
-571.5 -0.03039 -0.19893 6106 I-STATE 230 6104 TENOROC 230 1 C:9100-9120D 446 -454.4 -437.0 -0.01716 -377.1 -367.3
Open 9100 RECKER 230 9120 SELOSE 230 1

Study transfer level - 1000.0 MW. Total violations: 17
First violation - -626.4 MW.

Study transfer. From FMPP_EXA To PEF_IMA . Transfer level - 1000.0 MW


Violations report ordered by transfer capability. Total 17 violations

Thanks again,
Joe

Joe

1. U will have to tell us whose code is working. I think 3 or 4 code examples are here.
2. If u want to know what ur code does, u will have print the value to see, what it has.

For example

temp1 = item[:9]
    #print(temp1)  # test
    temp1 = extract_number(temp1)

I would do this to see what is happening.

print item
    temp1 = item[:9]
    print temp1
    #print(temp1)  # test
    temp1 = extract_number(temp1)
    print temp1

By doing so, u will have a better idea, what happens to ur string at each and every passing line.

I think u r using python 3.0. what does extract_number(temp1) do? is there a function like that in ver 3.0?

Sorry about that xav.vijay , I am new to this forum and I might be confusing myself thinking that someone is talking about the same problem. Below is the code I am mostly trying to understand, but I will probably go back and see what I can learn from the other codes. In the code below I think the matrix is set up [r,c] or [r:r,c:c], but I don't understand what variable represents the row. I am trying to get items from two different lines in the text file. I think the code looks for the words FCITC and take that line and increments it by one in line 10 (s += c) this number is stored in exact_number. My problem is I don't see how it is used in the matrix to select the items. I would also like to increment that number to get the items after the word open:
I was also trying to get the exact column to work to grab the parts I want out of my text file since it seems that when I pasted it on this site it messed up the spacing a little. I don't understand the bold section below. It defines Temp 2 as item[29:79] and then again as temp2[29:79].replace(']', ' ') I also don't understand the strip() and rstrip() variables, but to be honest I did not spend a lot of time on them last night, I ran out of time.
Thanks,
Joe

for item in mylist:
    temp1 = item[:9]
    #print(temp1)  # test
    temp1 = extract_number(temp1)
 
   [B] temp2 = item[29:79]
    #print(temp2)  # test
    temp2 = temp2[29:79].replace(']', ' ')
    temp2 = temp2.strip()[/B]    
    #print(temp2)  # test
    temp3 = item[80:135]
    #print(temp3)  # test
    temp3 = extract_between(temp3, '', '').rstrip()
    #print(temp3)  # test
 
    newlist.append((temp1, temp2, temp3))for item in mylist:
    temp1 = item[:9]
    #print(temp1)  # test
    temp1 = extract_number(temp1)
 
    [B]temp2 = item[29:79]
    #print(temp2)  # test
    temp2 = temp2[29:79].replace(']', ' ')
    temp2 = temp2.strip()
    #print(temp2)  # test[/B]    temp3 = item[80:135]
    #print(temp3)  # test
    temp3 = extract_between(temp3, '', '').rstrip()
    #print(temp3)  # test
 
    newlist.append((temp1, temp2, temp3))
def extract_number(data_str):    """    extract the numeric value from a string    (the string should contain only one numeric value)    return the numeric part of the string or None    """    s = ""    for c in data_str:        if c in '1234567890.-':            s += c    if s:        return s    else:        return None  def extract_between(text, sub1, sub2):    """    extract a substring from text between first    occurances of substrings sub1 and sub2    """    return text.split(sub1, 1)[-1].split(sub2, 1)[0]  # test filefname = "violate.dat" mylist = []flag = Falsefor line in open(fname):     if flag == True:        mylist.append(line)        flag = False    if "FCITC" in line:        flag = True newlist = []for item in mylist:    temp1 = item[:16]    #print(temp1)  # test    temp1 = extract_number(temp1)     temp2 = item[35:83]    #print(temp2)  # test    temp2 = temp2[6:28].replace(']', ' ')    temp2 = temp2.strip()    #print(temp2)  # test     temp3 = item[96:144]    #print(temp3)  # test    temp3 = extract_between(temp3, '[B]', '[/B]').rstrip()    #print(temp3)  # test     newlist.append((temp1, temp2, temp3))  print('-'*40) for tup in newlist:    print(tup) """my show -->('690.4', '5567 IND RIV      115', 'Base Case')('-756.5', '6106 I-STATE      230', '7890 OSCEOLA      230   9190 AGNES-RX')('589.3', '5704 TAFT         230', ' 2883 INTERCSN     230   5352 CAN ISL')('1905.9', '6101 MCINTOSH     230', ' 9100 RECKER       230   9150 LKAGNES')('1119.9', '2167 WINDERME     230', '5353-5800')('-1121.7', '467 POINSETT     230', '351 ORANGE R     230    354 ORANGE R')('1776.3', '461 CAPE K       230', '461 CAPE K       230   5703 IND RIV')('899.9', '5704 TAFT         230', ' 2883 INTERCSN     230   5352 CAN ISL')('-1670.7', '6106 I-STATE      230', 'BARCOLA      230   6102 WEST')('593.8', '5704 TAFT         230', '2883 INTERCSN     230   5352 CAN ISL')"""def extract_number(data_str):
    """
    extract the numeric value from a string
    (the string should contain only one numeric value)
    return the numeric part of the string or None
    """
    s = ""
    for c in data_str:
        if c in '1234567890.-':
            s += c
    if s:
        return s
    else:
        return None


def extract_between(text, sub1, sub2):
    """
    extract a substring from text between first
    occurances of substrings sub1 and sub2
    """
    return text.split(sub1, 1)[-1].split(sub2, 1)[0]


# test file
fname = "violate.dat"

mylist = []
flag = False
for line in open(fname):

    if flag == True:
        mylist.append(line)
        flag = False
    if "FCITC" in line:
        flag = True

newlist = []
for item in mylist:
    temp1 = item[:16]
    #print(temp1)  # test
    temp1 = extract_number(temp1)

    temp2 = item[35:83]
    #print(temp2)  # test
    temp2 = temp2[6:28].replace(']', ' ')
    temp2 = temp2.strip()
    #print(temp2)  # test

    temp3 = item[96:144]
    #print(temp3)  # test
    temp3 = extract_between(temp3, '[B]', '[/B]').rstrip()
    #print(temp3)  # test

    newlist.append((temp1, temp2, temp3))


print('-'*40)

for tup in newlist:
    print(tup)

"""my show -->
('690.4', '5567 IND RIV      115', 'Base Case')
('-756.5', '6106 I-STATE      230', '7890 OSCEOLA      230   9190 AGNES-RX')
('589.3', '5704 TAFT         230', ' 2883 INTERCSN     230   5352 CAN ISL')
('1905.9', '6101 MCINTOSH     230', ' 9100 RECKER       230   9150 LKAGNES')
('1119.9', '2167 WINDERME     230', '5353-5800')
('-1121.7', '467 POINSETT     230', '351 ORANGE R     230    354 ORANGE R')
('1776.3', '461 CAPE K       230', '461 CAPE K       230   5703 IND RIV')
('899.9', '5704 TAFT         230', ' 2883 INTERCSN     230   5352 CAN ISL')
('-1670.7', '6106 I-STATE      230', 'BARCOLA      230   6102 WEST')
('593.8', '5704 TAFT         230', '2883 INTERCSN     230   5352 CAN ISL')
"""

OK...
First ....We are dealing with a file with lots of text. No matrices.

some r,c does not always define row and column. At least not in ur case.

Second u wanted to know what temp1 does here...see example below.

>>> a = "Joe Hart"
>>> print a
Joe Hart
>>> print a[:3]
Joe
>>> print a[:4]
Joe 
>>> print a[:5]
Joe H
>>> print a[:6]
Joe Ha
>>> print a[2:6]
e Ha
>>> print a[1:]
oe Hart

I hope this gives u an idea, on what happens.
if u want to see more closely, u will have to print and see what it does as I had previously said.

print item
print item[29:79]
print temp2[29:79]
print temp2[29:79].replace(']', ' ')

This would give u a much better idea.

Thanks that was very helpful. I tried something else and set temp3 to line and print temp 3. This is the other text string I want but only from 9100 to 230 1, and for some reason it is right justified or has a lot of spaces in front.

Open 9100 RECKER 230 9120 SELOSE 230 1

How do I set it to temp 3

which variable has this entire line? temp3??

if so then

print temp3[4:]

or WhatEverVariable[4:]

I tried
print line. It showed me the line after the FCITC Value which has
Open: ..... I need whatever those dots represent. When I set temp3 = Line. And then print temp3, you get the Items I need except they are after a bunch of spaces or right justified, I am not really sure. I can't seem to figure out how to only grab the text from Line - the open statement. Just the Ex Open 9100 RECKER 230 9120 SELOSE 230 1 I only want the 9100 to 230 1. Any Ideas, or did I just really mess up my explaining what I need.

That's bcos ur syntax for file handling is wrong.

So yours is giving you the correct values? Even the one that is on the next line? What is the code? I can only get the first two but do not know how to increment the line to get the third one.

I think I finally got this one. Thanks for your help. I set Temp 3 = line and then set Temp4 = [86:150]Temp3. I am sure there is an easier way but I can mess with it more. Thanks for everyones help.
Joe

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.