I never took unix and wondering how to

hi i never took any unix and my professor for one of my classes want me to write a shell script i am wondering if anyone can help
i need to Write a script that outputs all lines in a file containing a specific keyword.

from a text file
try a unix forum rather than a C++ one would be a good start:
http://www.unix.com/

Also type "unix shell scripting tutorial for beginners" into youtube. Seems to be some vids on there as well.
Uh, why do you need a script for this when it can be done using two commands?

cat file | grep keyword

Example:
[13:00:32 residentbiscuit@zenalpha ~ ]$ cat .bashrc | grep if
if [ "$PS1" ]; then
  if [ -z "$PROMPT_COMMAND" ]; then
        if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
        if [ -e /etc/sysconfig/bash-prompt-screen ]; then
  # if [ "$PS1" ]; then
  # to your custom modification shell script in /etc/profile.d/ directory
if ! shopt -q login_shell ; then # We're not a login shell
                if [ "$2" = "after" ] ; then
    if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
    # Only display echos from profile.d scripts if we are no login shell
        if [ -r "$i" ]; then
            if [ "$PS1" ]; then
Last edited on
Also type "unix shell scripting tutorial for beginners" into youtube.
you dont even need youtube. there are hundreds of hits on google. also, i would specifiy a shell (more than likely bash) since thats what executes the shell script
i need to Write a script that outputs all lines in a file containing a specific keyword.

Take a look at grep.
https://www.freebsd.org/cgi/man.cgi?query=grep&apropos=0&sektion=0&manpath=FreeBSD+10.0-RELEASE&arch=default&format=html

For example, if you want to search the current directory for the phrase hello world,
 
grep "hello world" *
Topic archived. No new replies allowed.