Rczone
Rczone

Reputation: 501

Filter out the strings in series of files

i have a group of files with path names in a text file name "files.txt" like below

files.txt contains these files:

/usr/local/test1.txt
/usr/local/test2.txt
/usr/local/bin/grr.txt
/usr/local/oracle/test4.txt

now i have to grep(filter) values for the strings name "PackageName" and "ProcedureName" for all these files into a output.txt file

for ex : all the above files has the below content,now i want the values for PackageName and ProcedureName as in the format "XXbin/process" in an outputfile.

 <property name="PackageName" value="XXbin"/>
  <property name="ProcedureName" value="process"/>

tried:

find ${direct} -name "*.jca" -exec awk "/ && /PackageName/ && /ProcedureName/' {} \; >> out.txt

Upvotes: 0

Views: 49

Answers (1)

Ed Morton
Ed Morton

Reputation: 204239

You have a suprious / && at the start of your awk command and you have double quotes at the start of the awk script but single quotes at the end of the script and you're using && when you want ||.

In any case, keep it simple:

find "$direct" -name "*.jca" -print |
xargs awk '/(Package|Procedure)Name/'

Upvotes: 1

Related Questions