Results 1 to 2 of 2

Thread: Array

  1. #1
    Join Date
    May 2002
    Location
    Timbaktu
    Posts
    185

    Unanswered: Array

    I would like to read the output of the command below to an ARRAY:

    grep :/employee emp.lst | awk -F":" '{ print $1}'

    The output is like
    A
    B
    C
    D
    E
    F


    I don't know how to do that? Any help?

  2. #2
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    Try this

    echo "A:B:C:E:F" > emp.lst
    cat emp.lst | awk ' BEGIN {FS="|"}
    {
    split ($1,arr,":")
    print arr[1]
    print arr[2]
    print arr[3]
    print arr[4]
    print arr[5]
    }
    Greetings from germany
    Peter F.

Posting Permissions

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