![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to write perl substitute command in shell scripts | param_it | UNIX for Dummies Questions & Answers | 3 | 07-03-2007 05:09 AM |
| I need to write a shell script. | lakshmanrk | Shell Programming and Scripting | 6 | 06-20-2007 07:00 AM |
| please Write a shell script | rvrao77 | Shell Programming and Scripting | 6 | 11-16-2006 10:16 AM |
| need help to write shell script | getdpg | Shell Programming and Scripting | 0 | 04-10-2006 11:30 AM |
| Help needed to write a shell script! | sreedharsn | Shell Programming and Scripting | 3 | 10-11-2005 01:21 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Need to Write Shell Script based off of this shell command
I'm trying to read a bunch of log files and output the lines that contain particular strings.
To accomplish this, I've been running the following from the command line: find . -name "*" | xargs grep "[tT] [hH] [iI] [sS]" | grep "[tT] [hH] [aA] [tT]" > output.txt Two grep statements are needed in case I'm looking for a name that needs both first and last name. I'd like to have a shell script that could do this, where I run the script from the command line and enter the strings as arguments at run time. My biggest question is how do I ensure in the variable that both lowercase and uppercase letters are searched for each letter. I haven't written a shell script in a long time so I'm very rusty. Thanks for any help. |
|
||||
|
Quote:
Ah, so a grep -i would ignore case? Cool, what would the -e do? Stupid question I know.... |
|
||||
|
Code:
dkozel$ man grep | grep -e '-e' -A2
grep [options] [-e PATTERN | -f FILE] [FILE...]
DESCRIPTION
--
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (see
below).
--
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern; useful to protect patterns begin-
ning with -.
--
--exclude=PATTERN
Recurse in directories skip file matching PATTERN.
multiple -e's can be used to specify several search terms Code:
dkozel$ grep "term one\|term two\|term three" filename.txt ps: -A# shows # lines after search result |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|