Find the answer to your Linux question:
Results 1 to 2 of 2

Thread: fetch data

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Question fetch data

    I want to fetch data from a table (Filename table.txt)
    Table is like
    Data_One : 34
    Data_two : 45
    Data_three :
    45, 67

    P.S : Values are in next line and I cnat modify the file format
    now I wants to store the value 45 and 67 into two variables .

    for fetching Data_one value, I used the following command
    temp=$(cat table.txt | grep "Data_One" | sed s/[^0-9]*/)

    How can I get 45 and 67 into two variables.
    Plz give your suggestion

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    3rd rock from sun - Often seen near moon
    May be try cut ?

    var1=`cut -f1 -d','`
    var2=`cut -f2 -d','`
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    FOSS India Award winning ext3fs Undelete tool Online Linux Terminal

Posting Permissions

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