![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem using find and xargs | quixote | Shell Programming and Scripting | 5 | 05-02-2008 10:24 PM |
| 'find' and 'tar' combination | kharen11 | Shell Programming and Scripting | 2 | 02-06-2008 08:17 AM |
| command usage on find with xargs and tar | darkrainbow | AIX | 3 | 12-25-2007 06:25 PM |
| strange behavior of find with xargs | jerardfjay | Shell Programming and Scripting | 9 | 08-09-2007 08:06 AM |
| find | xargs cat | asal_email | Shell Programming and Scripting | 4 | 03-17-2005 12:16 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Combination of find -xargs & wc -l
Dear all,
I have to calculate sum of record count of files of the specified directory. First I tried the following way which prints one or more outputs. How can I sum of this output? Code:
find /home/work/tmp/1/O/ -type f -print0 | xargs -0 wc -l | grep total 1666288 total 1073908 total |
|
||||
|
Thank you very much,
There aren't any subdirectory. There are many files so I can't directly use wc or awk. Code:
wc -l * | tail -1 -bash: /usr/bin/wc: Argument list too long Code:
sum=0
for eachtotal in `find /home/work/tmp/1/O/ -maxdepth 1 -type f -print0 | xargs -0 wc -l | grep total | awk '{print $1}'`
do
sum=`expr $sum + $eachtotal`
done
echo $sum
![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|