Antw: Korn Shell Q
From: Dieter Zavelberg (dieter.zavelberg_at_POSTBANK.DE)
Date: 07/03/03
- Previous message: Jim McDonald: "Re: mail problem"
- Next in thread: Bob.Kelley_at_BRINKSINC.COM: "Re: Antw: Korn Shell Q"
- Maybe reply: Bob.Kelley_at_BRINKSINC.COM: "Re: Antw: Korn Shell Q"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 3 Jul 2003 09:07:51 +0200 To: aix-l@Princeton.EDU
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
- Previous message: Jim McDonald: "Re: mail problem"
- Next in thread: Bob.Kelley_at_BRINKSINC.COM: "Re: Antw: Korn Shell Q"
- Maybe reply: Bob.Kelley_at_BRINKSINC.COM: "Re: Antw: Korn Shell Q"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|