Computing.Net > Forums > Unix > korn shell help please

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

korn shell help please

Reply to Message Icon

Name: Mei
Date: December 14, 2002 at 02:13:15 Pacific
OS: sun 5.8
CPU/Ram: sun 5.8
Comment:

I know that
grep the_specified_string myfile
can finds a line that contains a specified string in a file. How can I reach the same goal in a korn shell script?

Thanks a lot for your help!

Mei



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: December 14, 2002 at 04:50:45 Pacific
Reply:

#!/bin/ksh
grep $1 myfile


There is precious little the korn shell does by itself but it is a wonderful glue.


0

Response Number 2
Name: Jerry Lemieux
Date: December 17, 2002 at 07:37:22 Pacific
Reply:

Get a copy of "The New Kornshell" by Morris I. Bolsky and David G. Korn. On page 276 is a version of the grep command written in Kornshell. You can use the logic in the example as a start point. It is essentially an exercise of opening a file, reading in each line and using the Kornshell's builtin pattern matching ability.

I completely disagree with the previous comment that there is precious little the Kornshell does by itself. I have rewritten many scripts and removed unnecessary awk and sed statements from them. Looking at the examples in the book I referenced, one would find the previous statement to be less than accurate.

Jerry


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Sco-Unix Bootable Floppy sco unix 5.0.4



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: korn shell help please

korn shell help www.computing.net/answers/unix/korn-shell-help/7834.html

Korn Shell HELP Needed!!! www.computing.net/answers/unix/korn-shell-help-needed-/2111.html

Korn Shell script help please!! www.computing.net/answers/unix/korn-shell-script-help-please/4345.html