[NTLUG:Discuss] Scripting help
Dennis Myhand
dmyhand at ednaisd.org
Tue Apr 28 09:34:34 CDT 2009
I am trying to show my hardware students some of the things that cane be
done from the command line once they get Linux installed on their
hardware. I was trying to show how to write a basic bash script that
would grep 'the' from a text file, run each instance of 'the' through wc
and redirect that output to another file called thecount.txt. I
originally thought that:
#!/bin/bash
grep 'the' > thecount.txt | wc
would work, but that does not seem to do the trick. So I changed the
order a bit and tried:
#!/bin/bash
grep 'the' | wc > thecount.txt
This does not seem to work either. I remember doing something like this
in school (10 years and 3 moves back) but I cannot seem to locate my
notes. What am I missing here, besides the notes, I mean? What would
be the best way to write this script? Thanks, Dennis in Victoria
More information about the Discuss
mailing list