Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, guys. I have one question. Assumed I have have a variable $userlist, it has the following contents: brownj smithk smithk2 smithk3 hynesp hynesp2 leeb ... How can I write ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    4

    How can I extract certain strings from a variable?

    Hi, guys. I have one question.

    Assumed I have have a variable $userlist, it has the following contents:

    brownj
    smithk
    smithk2
    smithk3
    hynesp
    hynesp2
    leeb
    ...

    How can I write a bash script that extracts all the strings smithk, smithk2, smithk3, etc from variable $userlist, and assigns these strings to a new variable?

    Thanks a lot in advance

    -K.D

  2. #2
    Linux Newbie
    Join Date
    Feb 2009
    Posts
    99
    $new=$(cat path_to_file)

Posting Permissions

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