Search Results

Search: Posts Made By: daveaztig14
28,666
Posted By Don Cragun
If we start from my script in post #32 in this...
If we start from my script in post #32 in this thread:
#!/bin/ksh
bad_found=0
dir='/files05/home/chgtprd/MXS/inb/CHTR/FTR/9/'
log='/files05/home/chgtprd/logfile.txt'

cd "$dir" && for file in *...
28,666
Posted By RavinderSingh13
Hello daveaztig14, Could you please change...
Hello daveaztig14,

Could you please change Input_file to /home/abainzd/Input_file and let me know how it goes.

#!/bin/ksh
bad_found=0
log='/home/abainzd/logfile.txt'
while read dir
do
cd...
28,666
Posted By RavinderSingh13
Hello daveaztig14, My sincere apologies,...
Hello daveaztig14,

My sincere apologies, somehow I have not written do after while, could you please try following.

#!/bin/ksh
bad_found=0
log='/home/abainzd/logfile.txt'
while read dir
do...
28,666
Posted By RavinderSingh13
Hello daveaztig14, A simple way could be put...
Hello daveaztig14,

A simple way could be put all the directories information into a Input_file and you could read it from there like for an example as follows.

cat Input_file...
28,666
Posted By Don Cragun
The directories you are searching, the strings...
The directories you are searching, the strings you are matching, the names of the files you are processing in the directories you are searching, and the shell you are using seems to change with every...
28,666
Posted By jlliagre
You stated twice you were using ksh but the...
You stated twice you were using ksh but the sample script posted here is using the legacy bourne shell /bin/sh which you should never use.

You'd rather start your scripts with one of:
...
28,666
Posted By MadeInGermany
Don, grep -q ... is not portable, and if ! does...
Don, grep -q ... is not portable, and if ! does not work in a Bourne shell.
Instead one needs grep ... >/dev/null,
and one of the following workarounds
grep ...
if [ $? -ne 0 ]
then
echo "not...
28,666
Posted By Don Cragun
What you have shown us is that there are four...
What you have shown us is that there are four lines in each of the files:
VZW997.03.26.2010:06:10:12.000
VZW997.03.26.2010:06:33:46.007
VZW997.03.26.2010:06:37:47.004...
28,666
Posted By RavinderSingh13
Hello daveaztig14, Could you please try...
Hello daveaztig14,

Could you please try following and let me know if this helps.

find . -type f -exec grep -H -c 'FTRORD' {} \+ | grep 0$ | cut -d':' -f1
I have checked above in BASH...
28,666
Posted By RudiC
Please take one step at a time. What you...
Please take one step at a time. What you presented in post#16 is NOT the directories from post#12. Use full absolute paths for a test, i.e. paths rooted at / and not using variables to be...
28,666
Posted By RudiC
OK, no bashisms. What happens if you create a...
OK, no bashisms. What happens if you create a dave.cfg file in your home directory containing
home/dave/banana BANANA
home/dave/orange ORANGE
home/dave/orange1 ORANGE...
28,666
Posted By RudiC
What's your shell? And: No PM please for...
What's your shell?

And: No PM please for technical questions/data.
28,666
Posted By Don Cragun
That is not what grep -v BRE file... does. That...
That is not what grep -v BRE file... does. That grep command gives you a list of every line in each of the given file operands that does NOT contain a string matching the basic regular expression...
28,666
Posted By RavinderSingh13
Hello daveaztig14, You requirement is not...
Hello daveaztig14,

You requirement is not clear but if you want to read/print the file's content on standard output in a specific directory then following may help you in same.

for file in...
28,666
Posted By RudiC
So you corrected the most obvious errors in your...
So you corrected the most obvious errors in your script, which is good. You are "open for other codes and scripts", which is good, too. Did you consider the "loop advice"?

We still don't know what...
28,666
Posted By RudiC
So, where do we start? Being an electronics...
So, where do we start? Being an electronics engineer, is the assumption correct that you know what a specification is? Loosely phrased, the description of a target (contents, shape, structure,...
28,666
Posted By RudiC
You failed to mention which shell you are using....
You failed to mention which shell you are using. With a not too old bash that has extended pattern matching with the extglob shell option, and a config file with directory and keyword in it...
28,666
Posted By RudiC
And, keyword always the same as the directory...
And, keyword always the same as the directory name? Should the search respect case or not?
Where should the config file reside?
28,666
Posted By RudiC
Could you post an example of your config data, or...
Could you post an example of your config data, or are you happy with any (new) structure of config file(s)?
Any subdirectories under e.g. /home/banana?
28,666
Posted By MadeInGermany
I hope this is not coursework/homework. And I...
I hope this is not coursework/homework.
And I assume that you want to check the file names (not the file data)
basedir=/home
log=$basedir/dummyevents.log

for word in banana apple orange
do
...
28,666
Posted By RudiC
Not sure if I understood correctly. Let me...
Not sure if I understood correctly. Let me paraphrase:
You have a handful of directories with some files in each. You want to check if those files have exactly ONE keyword in them, each directory...
Showing results 1 to 21 of 21

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