![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find , grep | james94538 | UNIX for Dummies Questions & Answers | 3 | 2 Days Ago 06:03 PM |
| grep, find or awk? | netrom | UNIX for Dummies Questions & Answers | 4 | 04-09-2008 02:03 PM |
| grep and find | MEllis5 | UNIX for Dummies Questions & Answers | 1 | 04-07-2008 05:16 AM |
| find and grep | sarwan | High Level Programming | 4 | 04-10-2006 04:05 AM |
| find & grep | Anika | UNIX for Dummies Questions & Answers | 11 | 02-01-2001 08:19 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
find then grep
I have some patterns that I need to match with the content of several files and I'm having trouble to do it
Here is what I tried already : ksh won't even execute this Code:
#!/bin/ksh path="/export/home/ipomwbas" pattern=$path"/flags" find . -name "*.properties" |\ while read file; do /usr/xpg4/bin/grep -f $pattern $file | cat >> results done Code:
find . -name "*.properties" | xargs /usr/xpg4/bin/grep -f flags | cat >> results |
| Forum Sponsor | ||
|
|
|
|||
|
@summer_cherry
I modified your suggestion to fit my situation like this : Code:
find . -name "*.properties" | xargs /usr/xpg4/bin/grep -f flags | sed 's/^.*\.properties://' | cat >> c Code:
PROPERTIES_PATH = c:/java/SM_Web/config/ Code:
.*\.host\= .*\.port\= .*\.url\= .*\.schema\= .*\.user.* .*\.password\= .*\.simulator.flag.* |