Re: Antw: Korn Shell Q

Bob.Kelley_at_BRINKSINC.COM
Date: 07/03/03

  • Next message: James Thompson: "Getting Jumbo Frames to work on a p630"
    Date:         Thu, 3 Jul 2003 08:51:25 -0500
    To: aix-l@Princeton.EDU
    
    

    thats one hell of an over-engineered grep!! :)

    reminds me of my Ping driver headcover.......

    |---------+------------------------------>
    | | Dieter Zavelberg |
    | | <dieter.zavelberg@P|
    | | OSTBANK.DE> |
    | | Sent by: IBM AIX |
    | | Discussion List |
    | | <aix-l@Princeton.ED|
    | | U> |
    | | |
    | | |
    | | 07/03/2003 02:07 AM|
    | | Please respond to |
    | | IBM AIX Discussion |
    | | List |
    | | |
    |---------+------------------------------>
    >------------------------------------------------------------------------------------------------------------------------------|
      | |
      | To: aix-l@Princeton.EDU |
      | cc: |
      | Subject: Antw: Korn Shell Q |
    >------------------------------------------------------------------------------------------------------------------------------|

    what about (for ksh)

    $ cat qwert ("your grep")
    qqq
    aaa
    yyy
    www
    sss
    xxx
    $ l=$(cat qwert | xargs)
    $ echo $l
    qqq aaa yyy www sss xxx
    $ set -A VAR $l # create array VAR with elements from "list" $l
    $ echo ${VAR[*]} # display all elements of VAR
    qqq aaa yyy www sss xxx
    $ echo ${#VAR[*]} # number of elements in VAR
    6
    $ echo ${VAR[0]} # first element has index 0
    qqq
    $ echo ${VAR[${#VAR[*]}-1]} # last element
    xxx

    >>> Singh@XAVIER.EDU 02.07.03 17:01:02 >>>
    Hello,

    Quick, simple korn shell question:

    I have the result of grep and cut commands that shows multiple lines. For
    example:

    345trh
    hur88
    kjsdhf
    eryyt9
    333ret

    How can I divide these lines to feed into variables? That is, each of the
    above lines needs to be assigned to a variable.

    Thanks

    --------------------------------
    "Colorless green ideas sleep furiously."
    --------------------------------
    Ranbir Singh
    System Administrator
    Xavier University
    Cincinnati, Ohio
    O: 513.745.3889
    E: singh@xavier.edu
    NOTICE TO BRINK'S EMPLOYEES:
    All electronic mail communications composed, sent, received or stored on or
    through Brink's equipment are subject to the Brink's Electronic
    Communications Policy. Employees should have no expectation of privacy in
    their use of the Company's electronic mail system.


  • Next message: James Thompson: "Getting Jumbo Frames to work on a p630"

    Relevant Pages

    • Antw: Korn Shell Q
      ... $ cat qwert ... $ echo ${VAR[*]} # display all elements of VAR ... I have the result of grep and cut commands that shows multiple lines. ...
      (AIX-L)
    • Re: ssh and chroot
      ... ++ echo /bin/mkdir ... ++ awk '' ... ++ grep '^/' ...
      (comp.security.ssh)
    • Re: Finding stream job signons
      ... it's a 'smart' grep. ... echo This command uses grep to search a fileset for all occurances ... setvar _g_grep_ok false ...
      (comp.sys.hp.mpe)
    • Re: Grep Question
      ... You can use single-quotes to enclose command arguments containing special characters so they won't be interpreted by the command shell. ... Subject: Grep Question ... If you wish to confirm the origin or content of this communication, ...
      (AIX-L)
    • Simplifying Grep Utility
      ... I'm trying to write a program that similair to the grep utitilty. ... echo " enter what to grep:" ...
      (comp.unix.shell)