Search Results

Search: Posts Made By: emc^24sho
2,396
Posted By CarloM
find DVLP -type d -name XYZ -print0 finds...
find DVLP -type d -name XYZ -print0 finds directories under DVLP which are called XYZ. -print0 outputs them NUL-terminated, which is just a precaution in case any directory names have whitespace in...
45,844
Posted By Don Cragun
Please try the following commands: uname -a ...
Please try the following commands:
uname -a
xmlFileNames=$(find . -name "*.xml" -exec grep -Fl "Status" {} '+')
printf "find w/ grep -F exit code: %d\n" $?
xmlFileNames=$(find . -name "*.xml"...
45,844
Posted By Corona688
Try: xmlFileNames=$(find . -name "*.xml" -exec...
Try: xmlFileNames=$(find . -name "*.xml" -exec grep -l "Status" {} '+' 2>/dev/null) This should put more filenames into a single grep and make it more efficient.
1,414
Posted By Yoda
From GNU grep manual: -l, --files-with-matches ...
From GNU grep manual:
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. The
scanning will stop...
1,414
Posted By MadeInGermany
Confirmed. I tested a bunch of grep versions....
Confirmed.
I tested a bunch of grep versions. They all stop reading the current file when invoked with -l and finding a match.
45,844
Posted By Corona688
If you show what you're doing right now, maybe we...
If you show what you're doing right now, maybe we can speed it up.
45,844
Posted By Don Cragun
If you're looking for a fixed string (rather than...
If you're looking for a fixed string (rather than a match against a regular expression), use grep -F or fgrep (depending on which operating system you're using).

If you're trying to match the 1st...
45,844
Posted By bartus11
If all of those files are in the current...
If all of those files are in the current directory, then this might work:for file in *.xml; do
head -8 $file | grep <whatever you need to grep> >/dev/null && echo $file
done
1,414
Posted By Don Cragun
Most implementations of the awk utility will stop...
Most implementations of the awk utility will stop reading the current file when a match is found when the -l is given on the command line. (There is no requirement that grep quit reading the file...
1,414
Posted By selvankj
Of course its going to give list of all the files...
Of course its going to give list of all the files which matches the criteria in that particular directory...
1,414
Posted By RavinderSingh13
Hi, Could you please give your exact...
Hi,

Could you please give your exact requirement so that we can provide you a better solution/suggestion on same.


Thanks,
R. Singh
1,383
Posted By Scrutinizer
You would need: $(echo "$XmlFileName" | sed...
You would need: $(echo "$XmlFileName" | sed 's|^\./||')
or better, try:
do
cp "${XmlFileName#./}" "$NEW_DIR/"
done
1,777
Posted By Scott
Yes. xmlFileNames=$(grep -l Status "*.xml") ...
Yes.

xmlFileNames=$(grep -l Status "*.xml")
for file in $xmlFileNames; do
...
done

Just be aware that if there are too many filenames you might get an error ("too many args").

You might...
1,777
Posted By Corona688
".*Status" is a bit redundant, "Status" would...
".*Status" is a bit redundant, "Status" would do.
1,777
Posted By Scott
Only if you run it from / (the root directory),...
Only if you run it from / (the root directory), otherwise:


xmlFileNames=$(find / ...)

would be required (/ instead of .)

You might encounter a lot of errors (access denied, or other) along...
1,777
Posted By Scott
It searches for all XML files in the current...
It searches for all XML files in the current directory hierarchy (find . -name "*.xml") for the string Status (-exec grep -l ".*Status") (the .* in this search pattern is superfluous), returning the...
Showing results 1 to 16 of 16

 
All times are GMT -4. The time now is 04:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy