Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Retrieve last field in each line  (Read 3070 times)

0 Members and 1 Guest are viewing this topic.

et_phonehome_2

    Topic Starter


    Beginner

    Thanked: 2
    Retrieve last field in each line
    « on: August 01, 2011, 04:30:09 PM »
    I want to read a line from a text file, and am interested in assigning the last field to a variable.  How do I do this without hardcoding the position, I want the script to be flexible enough to handle varying number of columns.

    Dusty



      Egghead

    • I could if she would, but she won't so I don't.
    • Thanked: 75
    • Experience: Beginner
    • OS: Windows XP
    Re: Retrieve last field in each line
    « Reply #1 on: August 05, 2011, 04:49:49 PM »
    Is the 'text' file space delimited?
    One good deed is worth more than a year of good intentions.

    Salmon Trout

    • Guest
    Re: Retrieve last field in each line
    « Reply #2 on: August 06, 2011, 05:00:59 AM »
    We have been asked to supply script code to extract the last "field" from a line of text, but we have not been told how the fields are delimited. Dusty has already asked about this. Until this is known, it will be difficult to provide a suitably robust solution.