script of reading one type of files in multiple directory
up vote
0
down vote
favorite
I have the Directory like 2018-01-10
, 2018-02,10
and so on. In each directory it contains .CUD
and .CUR
files. I want the number of data (i.e. wc -l
) which are in .CUD
files only.
I used following command:
for D in /; do
wc -l ${D}/ > ${D%/}Request
done
It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD
files only.
bash scripts wc
New contributor
add a comment |
up vote
0
down vote
favorite
I have the Directory like 2018-01-10
, 2018-02,10
and so on. In each directory it contains .CUD
and .CUR
files. I want the number of data (i.e. wc -l
) which are in .CUD
files only.
I used following command:
for D in /; do
wc -l ${D}/ > ${D%/}Request
done
It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD
files only.
bash scripts wc
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the Directory like 2018-01-10
, 2018-02,10
and so on. In each directory it contains .CUD
and .CUR
files. I want the number of data (i.e. wc -l
) which are in .CUD
files only.
I used following command:
for D in /; do
wc -l ${D}/ > ${D%/}Request
done
It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD
files only.
bash scripts wc
New contributor
I have the Directory like 2018-01-10
, 2018-02,10
and so on. In each directory it contains .CUD
and .CUR
files. I want the number of data (i.e. wc -l
) which are in .CUD
files only.
I used following command:
for D in /; do
wc -l ${D}/ > ${D%/}Request
done
It worked fine but the result i'm getting is for all the files which are in the directory. I need the results for .CUD
files only.
bash scripts wc
bash scripts wc
New contributor
New contributor
edited 2 days ago
Mr Shunz
2,2011722
2,2011722
New contributor
asked 2 days ago
user893815
11
11
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Read man find
,man xargs
and use something like
find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
3
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
1
If you readman find
you'll see that you can replace the.
(the current directory) with a list of directories forfind
to start searching. Also, DON'T SHOUT.
– waltinator
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Read man find
,man xargs
and use something like
find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
3
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
1
If you readman find
you'll see that you can replace the.
(the current directory) with a list of directories forfind
to start searching. Also, DON'T SHOUT.
– waltinator
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
add a comment |
up vote
0
down vote
Read man find
,man xargs
and use something like
find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
3
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
1
If you readman find
you'll see that you can replace the.
(the current directory) with a list of directories forfind
to start searching. Also, DON'T SHOUT.
– waltinator
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
add a comment |
up vote
0
down vote
up vote
0
down vote
Read man find
,man xargs
and use something like
find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l
Read man find
,man xargs
and use something like
find . -type f -name '*.CUD' -print0 | xargs -0 -r wc -l
answered 2 days ago
waltinator
21.6k74169
21.6k74169
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
3
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
1
If you readman find
you'll see that you can replace the.
(the current directory) with a list of directories forfind
to start searching. Also, DON'T SHOUT.
– waltinator
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
add a comment |
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
3
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
1
If you readman find
you'll see that you can replace the.
(the current directory) with a list of directories forfind
to start searching. Also, DON'T SHOUT.
– waltinator
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
THIS WILL NOT WORK BECAUSE THERE ARE MULTILPLE DIRECTORY FROM WHICH I HAVE TO RETRIEVE DATA .
– user893815
2 days ago
3
3
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
@user893815 - What happened when you execute the above command?
– Yaron
2 days ago
1
1
If you read
man find
you'll see that you can replace the .
(the current directory) with a list of directories for find
to start searching. Also, DON'T SHOUT.– waltinator
2 days ago
If you read
man find
you'll see that you can replace the .
(the current directory) with a list of directories for find
to start searching. Also, DON'T SHOUT.– waltinator
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
waltinator if you don't understand the situation . DON'T COMMENT
– user893815
2 days ago
add a comment |
user893815 is a new contributor. Be nice, and check out our Code of Conduct.
user893815 is a new contributor. Be nice, and check out our Code of Conduct.
user893815 is a new contributor. Be nice, and check out our Code of Conduct.
user893815 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1094143%2fscript-of-reading-one-type-of-files-in-multiple-directory%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown