sslug-teknik team mailing list archive
-
sslug-teknik team
-
Mailing list archive
-
Message #52666
Re: xargs?
Peter Toft wrote:
Hej rødder
Har I nogle gode eksempler jeg kan bruge?
Lad os forestille os at du arbejder med OpenOffice og gerne vil have
listet alle C++ program- og header-files.
find oo_1.0_src -name "*\.[cp][xp+]*" -print | sort >
oo_1.0_src-020628-ch.find
OK
ls -lad `cat oo_1.0_src-020628-ch.find`
bash: /bin/ls: Argumentlisten er for lang
Why???
wc oo_1.0_src-020628-ch.find
24469 24469 1447653 oo_1.0_src-020628-ch.find
OK - Let me try
cat oo_1.0_src-020628-ch.find | xargs ls -lad
Voila!
Lad os så forestille os at du af en eller anden grund gerne vil vide
hvor mange linier der i disse 24469 filer.
cat oo_1.0_src-020628-ch.find | xargs wc > oo_1.0_src-020628-ch.wc
grep totalt oo_1.0_src-020628-ch.wc | sed -e 's/^ *//' | cut -d" " -f1
131577
127898
75479
74425
110610
41771
64181
106948
78790
78319
65719
17602
12926
82373
143337
47587
228524
37182
42555
12598
12386
12716
13018
12611
33964
69986
111248
255048
163773
204326
165451
185183
168562
100862
23767
11780
11478
11946
12343
11774
21540
81951
67339
69241
68772
57865
12370
11414
12013
12356
11139
13657
72133
67569
69476
70946
75764
65126
39937
131657
182574
13138
107217
359886
258884
404380
209437
89070
153969
98418
37161
28795
37315
254676
99156
145677
37266
Jeg har ikke lige fundet en one-liner som lægger tallene sammen :-(
--
Mvh Hans Christian Studt mailto:hcstudt@xxxxxxxx http://hc.studt.dk
If Windows XP is the answer, Then you didn't understand the question.
Linux information
http://linux.studt.dk
References
-
xargs?
From: Peter Toft, 2002-06-28