Operating System - HP-UX
1752720 Members
5834 Online
108789 Solutions
New Discussion юеВ

puting the counted files using wc -l in variable

 
SOLVED
Go to solution
Pando
Regular Advisor

puting the counted files using wc -l in variable

Dear Gurus,

I have used the command line below to count the current files created this day :

ls -la *.xml | grep "$datenow" | wc -l

I have used "$datenow" variable for the current date but i have no idea how to put the counted files in a variable.

Any help is highly appreciated.
2 REPLIES 2
Paul Eadington_1
Valued Contributor
Solution

Re: puting the counted files using wc -l in variable

VARIABLE=`ls -la *.xml | grep "$datenow" | wc -l`

That should do the trick for you.
I had hair .. then I got into Unix
Pando
Regular Advisor

Re: puting the counted files using wc -l in variable

i have found the solution by puting it using the symbol ">" (writing standard output to file).