File README changed (mode: 100644) (index 2aeaa88..a69a6ec) |
... |
... |
vidir |
11 |
11 |
edit a directory in your text editor |
edit a directory in your text editor |
12 |
12 |
vipe |
vipe |
13 |
13 |
edit a pipe using your text editor |
edit a pipe using your text editor |
14 |
|
and |
|
15 |
|
print lines that are present in one file and another |
|
16 |
|
not |
|
17 |
|
print lines that are present in one file but not another |
|
|
14 |
|
combine |
|
15 |
|
combine the lines in two files using boolean operations |
18 |
16 |
ifdata |
ifdata |
19 |
17 |
get network interface info without parsing ifconfig output |
get network interface info without parsing ifconfig output |
20 |
18 |
|
|
|
... |
... |
Your suggestions of additional tools to add to this collection are |
23 |
21 |
apprecitated. Here are some that are under consideration but have not yet |
apprecitated. Here are some that are under consideration but have not yet |
24 |
22 |
been included, I also welcome feedback on which of these to include. |
been included, I also welcome feedback on which of these to include. |
25 |
23 |
|
|
26 |
|
_ |
|
27 |
|
Matt Taggart suggests that and(1) and not(1) be integrated into one |
|
28 |
|
utility taking a page from test(1)/[. It would work like this: |
|
29 |
|
|
|
30 |
|
_ file1 and file2 |
|
31 |
|
_ file1 not file2 |
|
32 |
|
|
|
33 |
|
Where any file can be "-" for stdin. Could also add "or", "xor", |
|
34 |
|
etc to this. This makes it much clearer which file is on which side |
|
35 |
|
of the boolean expression. |
|
36 |
|
|
|
37 |
|
If it's called "_" that should probably be an alias for something |
|
38 |
|
longer, such as lcombine. What exactly to call it is the unresolved |
|
39 |
|
question -- is "_" something moreutils can justify taking for this? |
|
40 |
|
|
|
41 |
24 |
mime |
mime |
42 |
25 |
determines the mime type of a file using the gnome mine database |
determines the mime type of a file using the gnome mine database |
43 |
26 |
|
|
File and deleted (index 4165410..0000000) |
1 |
|
#!/usr/bin/perl |
|
2 |
|
|
|
3 |
|
=head1 NAME |
|
4 |
|
|
|
5 |
|
and - print lines that are present in one file and another |
|
6 |
|
|
|
7 |
|
=head1 SYNOPSIS |
|
8 |
|
|
|
9 |
|
and file |
|
10 |
|
|
|
11 |
|
and [file|-] [file|-] ... |
|
12 |
|
|
|
13 |
|
=head1 DESCRIPTION |
|
14 |
|
|
|
15 |
|
B<and> reads the specified files and prints out the lines that are common |
|
16 |
|
to all files, in the order they are listed in the last file. Use "-" to |
|
17 |
|
make it read a file from standard input. If only one file is specified, |
|
18 |
|
B<and> first reads standard input, and compares it with the specified file. |
|
19 |
|
|
|
20 |
|
=head1 AUTHOR |
|
21 |
|
|
|
22 |
|
Copyright 2006 by Joey Hess <joey@kitenet.net> |
|
23 |
|
|
|
24 |
|
Licensed under the GNU GPL. |
|
25 |
|
|
|
26 |
|
=cut |
|
27 |
|
|
|
28 |
|
use warnings; |
|
29 |
|
use strict; |
|
30 |
|
|
|
31 |
|
if (@ARGV == 0) { |
|
32 |
|
die "usage: and [file|-] [file|-] ...\n"; |
|
33 |
|
} |
|
34 |
|
|
|
35 |
|
if (@ARGV == 1) { |
|
36 |
|
unshift @ARGV, "-"; |
|
37 |
|
} |
|
38 |
|
|
|
39 |
|
my %seen; |
|
40 |
|
foreach my $fn (@ARGV) { |
|
41 |
|
open (IN, $fn) || die "and: read $fn: $!\n"; |
|
42 |
|
while (<IN>) { |
|
43 |
|
chomp; |
|
44 |
|
$seen{$_}++; |
|
45 |
|
if ($seen{$_} == @ARGV) { |
|
46 |
|
print "$_\n"; |
|
47 |
|
} |
|
48 |
|
} |
|
49 |
|
close IN; |
|
50 |
|
} |
|
File combine added (mode: 100755) (index 0000000..ad61f52) |
|
1 |
|
#!/usr/bin/perl |
|
2 |
|
|
|
3 |
|
=head1 NAME |
|
4 |
|
|
|
5 |
|
combine - combine the lines in two files using boolean operations |
|
6 |
|
|
|
7 |
|
=head1 SYNOPSIS |
|
8 |
|
|
|
9 |
|
combine file1 and file2 |
|
10 |
|
|
|
11 |
|
combine file1 not file2 |
|
12 |
|
|
|
13 |
|
combine file1 or file2 |
|
14 |
|
|
|
15 |
|
combine file1 xor file2 |
|
16 |
|
|
|
17 |
|
_ file1 and file2 _ |
|
18 |
|
|
|
19 |
|
_ file1 not file2 _ |
|
20 |
|
|
|
21 |
|
_ file1 or file2 _ |
|
22 |
|
|
|
23 |
|
_ file1 xor file2 _ |
|
24 |
|
|
|
25 |
|
=head1 DESCRIPTION |
|
26 |
|
|
|
27 |
|
B<combine> conbines the lines in two files. Depending on the boolean |
|
28 |
|
operation specified, the contents will be combined in different ways: |
|
29 |
|
|
|
30 |
|
=over 4 |
|
31 |
|
|
|
32 |
|
=item and |
|
33 |
|
|
|
34 |
|
Outputs lines that are common to both files. |
|
35 |
|
|
|
36 |
|
=item not |
|
37 |
|
|
|
38 |
|
Outputs lines that are in file1 but not in file2. |
|
39 |
|
|
|
40 |
|
=item or |
|
41 |
|
|
|
42 |
|
Outputs lines that are in file1 or file2. |
|
43 |
|
|
|
44 |
|
=item xor |
|
45 |
|
|
|
46 |
|
Outputs lines that are in either file1 or file2, but not in both files. |
|
47 |
|
|
|
48 |
|
=back |
|
49 |
|
|
|
50 |
|
"-" can be specified for either file to read stdin for that file. |
|
51 |
|
|
|
52 |
|
The input files need not be sorted, and the lines are output in the order |
|
53 |
|
they accur in file1 (or file2 for the two "or" operations). |
|
54 |
|
|
|
55 |
|
Note that this program can be installed as "_" to allow for the syntactic |
|
56 |
|
sugar shown in the latter half of the synopsis (similar to the test/[ |
|
57 |
|
command). It is not currently installed as "_" by default. |
|
58 |
|
|
|
59 |
|
=head1 AUTHOR |
|
60 |
|
|
|
61 |
|
Copyright 2006 by Joey Hess <joey@kitenet.net> |
|
62 |
|
|
|
63 |
|
Licensed under the GNU GPL. |
|
64 |
|
|
|
65 |
|
=cut |
|
66 |
|
|
|
67 |
|
use warnings; |
|
68 |
|
use strict; |
|
69 |
|
|
|
70 |
|
sub filemap { |
|
71 |
|
my $file=shift; |
|
72 |
|
my $sub=shift; |
|
73 |
|
|
|
74 |
|
open (IN, $file) || die "$file: $!\n"; |
|
75 |
|
while (<IN>) { |
|
76 |
|
chomp; |
|
77 |
|
$sub->(); |
|
78 |
|
} |
|
79 |
|
close IN; |
|
80 |
|
} |
|
81 |
|
|
|
82 |
|
sub hashify { |
|
83 |
|
my $file=shift; |
|
84 |
|
|
|
85 |
|
my %seen; |
|
86 |
|
filemap $file, sub { $seen{$_}++ }; |
|
87 |
|
return \%seen; |
|
88 |
|
} |
|
89 |
|
|
|
90 |
|
sub compare_or { |
|
91 |
|
my ($file1, $file2) = @_; |
|
92 |
|
|
|
93 |
|
my $seen; |
|
94 |
|
filemap $file1, sub { print "$_\n"; $seen->{$_}++ }; |
|
95 |
|
filemap $file2, sub { print "$_\n" unless $seen->{$_} }; |
|
96 |
|
} |
|
97 |
|
|
|
98 |
|
sub compare_xor { |
|
99 |
|
my ($file1, $file2) = @_; |
|
100 |
|
|
|
101 |
|
compare_not($file1, $file2); |
|
102 |
|
compare_not($file2, $file1); |
|
103 |
|
} |
|
104 |
|
|
|
105 |
|
sub compare_not { |
|
106 |
|
my ($file1, $file2) = @_; |
|
107 |
|
|
|
108 |
|
my $seen=hashify($file2); |
|
109 |
|
filemap $file1, sub { print "$_\n" unless $seen->{$_} }; |
|
110 |
|
} |
|
111 |
|
|
|
112 |
|
sub compare_and { |
|
113 |
|
my ($file1, $file2) = @_; |
|
114 |
|
|
|
115 |
|
my $seen=hashify($file2); |
|
116 |
|
filemap $file1, sub { print "$_\n" if $seen->{$_} }; |
|
117 |
|
} |
|
118 |
|
|
|
119 |
|
if (@ARGV >= 4 && $ARGV[3] eq "_") { |
|
120 |
|
delete $ARGV[3]; |
|
121 |
|
} |
|
122 |
|
|
|
123 |
|
if (@ARGV != 3) { |
|
124 |
|
die "usage: combine file1 OP file2\n"; |
|
125 |
|
} |
|
126 |
|
|
|
127 |
|
my $file1=shift; |
|
128 |
|
my $op=shift; |
|
129 |
|
my $file2=shift; |
|
130 |
|
|
|
131 |
|
if ($::{"compare_$op"}) { |
|
132 |
|
no strict 'refs'; |
|
133 |
|
"compare_$op"->($file1, $file2); |
|
134 |
|
} |
|
135 |
|
else { |
|
136 |
|
die "unknown operation, $op\n"; |
|
137 |
|
} |
File debian/changelog changed (mode: 100644) (index e563801..9eeedd9) |
1 |
|
moreutils (0.5) UNRELEASED; urgency=low |
|
|
1 |
|
moreutils (0.5) unstable; urgency=low |
2 |
2 |
|
|
3 |
3 |
* Added ifdata, by Benjamin BAYART (originally called ifcfg). |
* Added ifdata, by Benjamin BAYART (originally called ifcfg). |
4 |
4 |
* Made ifdata -Wall clean. |
* Made ifdata -Wall clean. |
|
... |
... |
moreutils (0.5) UNRELEASED; urgency=low |
6 |
6 |
* Cleaned up ifdata's behavior when asked to print info for nonexistant |
* Cleaned up ifdata's behavior when asked to print info for nonexistant |
7 |
7 |
devices. Still needs improvement. |
devices. Still needs improvement. |
8 |
8 |
* Indentation improvements. |
* Indentation improvements. |
9 |
|
* README updates based on user feedback. |
|
|
9 |
|
* Replaced and(1) and not(1) by combine, based on an idea by Matt Taggart. |
10 |
10 |
|
|
11 |
|
-- Joey Hess <joeyh@debian.org> Tue, 7 Mar 2006 21:54:45 -0500 |
|
|
11 |
|
-- Joey Hess <joeyh@debian.org> Tue, 7 Mar 2006 23:02:14 -0500 |
12 |
12 |
|
|
13 |
13 |
moreutils (0.4) unstable; urgency=low |
moreutils (0.4) unstable; urgency=low |
14 |
14 |
|
|
File debian/control changed (mode: 100644) (index 44b6d2d..d0c752e) |
... |
... |
Description: additional unix utilities |
18 |
18 |
- ts: timestamp standard input |
- ts: timestamp standard input |
19 |
19 |
- vidir: edit a directory in your text editor |
- vidir: edit a directory in your text editor |
20 |
20 |
- vipe: edit a pipe using your text editor |
- vipe: edit a pipe using your text editor |
21 |
|
- and: print lines that are present in one file and another |
|
22 |
|
- not: print lines that are present in one file but not another |
|
|
21 |
|
- combine: combine the lines in two files using boolean operations |
23 |
22 |
- ifdata: get network interface info without parsing ifconfig output |
- ifdata: get network interface info without parsing ifconfig output |
File not deleted (index c67467c..0000000) |
1 |
|
#!/usr/bin/perl |
|
2 |
|
|
|
3 |
|
=head1 NAME |
|
4 |
|
|
|
5 |
|
not - print lines that are present in one file but not another |
|
6 |
|
|
|
7 |
|
=head1 SYNOPSIS |
|
8 |
|
|
|
9 |
|
not file |
|
10 |
|
|
|
11 |
|
not [file|-] [file|-] ... |
|
12 |
|
|
|
13 |
|
=head1 DESCRIPTION |
|
14 |
|
|
|
15 |
|
B<not> reads the specified files and prints out the lines that are present |
|
16 |
|
in the first but not in subsequent files. Use "-" to make it read a file |
|
17 |
|
from standard input. If only one file is specified, B<not> first reads |
|
18 |
|
standard input, and compares it with the specified file. |
|
19 |
|
|
|
20 |
|
=head1 AUTHOR |
|
21 |
|
|
|
22 |
|
Copyright 2006 by Joey Hess <joey@kitenet.net> |
|
23 |
|
|
|
24 |
|
Licensed under the GNU GPL. |
|
25 |
|
|
|
26 |
|
=cut |
|
27 |
|
|
|
28 |
|
use warnings; |
|
29 |
|
use strict; |
|
30 |
|
|
|
31 |
|
if (@ARGV == 0) { |
|
32 |
|
die "usage: not [file|-] [file|-] ...\n"; |
|
33 |
|
} |
|
34 |
|
|
|
35 |
|
if (@ARGV == 1) { |
|
36 |
|
unshift @ARGV, "-"; |
|
37 |
|
} |
|
38 |
|
|
|
39 |
|
my $first=shift; |
|
40 |
|
|
|
41 |
|
my %seen; |
|
42 |
|
foreach my $fn (@ARGV) { |
|
43 |
|
open (IN, $fn) || die "and: read $fn: $!\n"; |
|
44 |
|
while (<IN>) { |
|
45 |
|
chomp; |
|
46 |
|
$seen{$_}++; |
|
47 |
|
} |
|
48 |
|
close IN; |
|
49 |
|
} |
|
50 |
|
|
|
51 |
|
|
|
52 |
|
open (IN, $first) || die "and: read $first: $!\n"; |
|
53 |
|
while (<IN>) { |
|
54 |
|
chomp; |
|
55 |
|
print "$_\n" if ! $seen{$_}; |
|
56 |
|
} |
|
57 |
|
close IN; |
|