10-24-2008
thats awesome, thanks to the both of you
How about excluding 'root' from the output?
10 More Discussions You Might Find Interesting
1. HP-UX
All,
Can anybody provide me the links to the documentation on UniQPrint?
I need to prepare some documents to help my co-workers to learn UniQPrint.
Regards,
Vishal (0 Replies)
Discussion started by: vishal_ranjan
0 Replies
2. Shell Programming and Scripting
Hi,
I can't find how to achive such thing, please help.
I have try with uniq and comm but those command can't compare columns just whole lines,
I think awk will be the best but awk is magic for me as of now.
file a
a1~a2~a3~a4~a6~a7~a8
file b
b1~b2~b3~b4~b6~b7~b8
output 1:
compare... (2 Replies)
Discussion started by: pp56825
2 Replies
3. Shell Programming and Scripting
Hi
I am currently using uniq -u and uniq -d option in my program to get uniq and duplicate lines from file.
What i doing is
uniq -c file1>file_u
uniq -d file1>file_d
cat file_u file_d > file_fiinal
Since i am procesing a larger files the I/O operations is costly affair.
Hence I would... (0 Replies)
Discussion started by: dhanamurthy
0 Replies
4. Shell Programming and Scripting
Hi ,
Just to find out a way to compare these 2 files and give unique output.
For eg:
1.txt contains
1
2
3
4
5
6
--------------------------------------
2.txt contains
1
2
6
8 (1 Reply)
Discussion started by: rauphelhunter
1 Replies
5. UNIX for Dummies Questions & Answers
Dear all,
It's not entirely clear to me from manpage the difference between them.
Why we still need "-u" flag?
- monkfan (3 Replies)
Discussion started by: monkfan
3 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I'm having an consistency issue....
grep 'a' /usr/share/dict/words
1) This will highlight every 'a' in each word.
grep 'a\{1,\}' /usr/share/dict/words
2) This will highlight 'a' if it occurs at least once in a sequence. So every 'a'.
Output of 1) I would... (1 Reply)
Discussion started by: MykC
1 Replies
7. Shell Programming and Scripting
When I do uniq -c on a list of sorted numbers,
for eg:
1
1
2
2
2
3
3
4
It outputs 2 1
3 2
2 3
1 4.
Now, is there a way to sort on the column that "uniq -c" produced? (2 Replies)
Discussion started by: prasanna1157
2 Replies
8. UNIX for Dummies Questions & Answers
Hi, I have the following file called addresses, (it is a large file i have only copy and pasted few of the data below) and I am wanting to write a command so it will Find the ratio of mobile (07....) to land line (01....) telephone numbers?
then find the most popular first name and list the... (1 Reply)
Discussion started by: tina_2010
1 Replies
9. Shell Programming and Scripting
I have a master list of servers. I also have a list of servers I'm not supposed to touch. I'm trying to filter out the list servers that I'm not supposed to touch from the master list of servers, so I will have a "master list of servers I can touch". When I try to filter these I'm not getting... (4 Replies)
Discussion started by: MaindotC
4 Replies
10. Shell Programming and Scripting
hello
I want to check on first column duplicates and print the unique first and second columns
My trial output is not generating what I needed, i.e the second column.
thanks in advance (5 Replies)
Discussion started by: bhargavpbk88
5 Replies
LEARN ABOUT MOJAVE
data::dumper::concise::sugar5.18
Data::Dumper::Concise::Sugar(3) User Contributed Perl Documentation Data::Dumper::Concise::Sugar(3)
NAME
Data::Dumper::Concise::Sugar - return Dwarn @return_value
SYNOPSIS
use Data::Dumper::Concise::Sugar;
return Dwarn some_call(...)
is equivalent to:
use Data::Dumper::Concise;
if (wantarray) {
my @return = some_call(...);
warn Dumper(@return);
return @return;
} else {
my $return = some_call(...);
warn Dumper($return);
return $return;
}
but shorter. If you need to force scalar context on the value,
use Data::Dumper::Concise::Sugar;
return DwarnS some_call(...)
is equivalent to:
use Data::Dumper::Concise;
my $return = some_call(...);
warn Dumper($return);
return $return;
If you need to force list context on the value,
use Data::Dumper::Concise::Sugar;
return DwarnL some_call(...)
is equivalent to:
use Data::Dumper::Concise;
my @return = some_call(...);
warn Dumper(@return);
return @return;
If you want to label your output, try DwarnN
use Data::Dumper::Concise::Sugar;
return DwarnN $foo
is equivalent to:
use Data::Dumper::Concise;
my @return = some_call(...);
warn '$foo => ' . Dumper(@return);
return @return;
If you want to output a reference returned by a method easily, try $Dwarn
$foo->bar->{baz}->$Dwarn
is equivalent to:
my $return = $foo->bar->{baz};
warn Dumper($return);
return $return;
If you want to format the output of your data structures, try DwarnF
my ($a, $c) = DwarnF { "awesome: $_[0] not awesome: $_[1]" } $awesome, $cheesy;
is equivalent to:
my @return = ($awesome, $cheesy);
warn DumperF { "awesome: $_[0] not awesome: $_[1]" } $awesome, $cheesy;
return @return;
If you want to immediately die after outputting the data structure, every Dwarn subroutine has a paired Ddie version, so just replace the
warn with die. For example:
DdieL 'foo', { bar => 'baz' };
DESCRIPTION
use Data::Dumper::Concise::Sugar;
will import Dwarn, $Dwarn, DwarnL, DwarnN, and DwarnS into your namespace. Using Exporter, so see its docs for ways to make it do something
else.
Dwarn
sub Dwarn { return DwarnL(@_) if wantarray; DwarnS($_[0]) }
$Dwarn
$Dwarn = &Dwarn
$DwarnN
$DwarnN = &DwarnN
DwarnL
sub Dwarn { warn Data::Dumper::Concise::Dumper @_; @_ }
DwarnS
sub DwarnS ($) { warn Data::Dumper::Concise::Dumper $_[0]; $_[0] }
DwarnN
sub DwarnN { warn '$argname => ' . Data::Dumper::Concise::Dumper $_[0]; $_[0] }
Note: this requires Devel::ArgNames to be installed.
DwarnF
sub DwarnF (&@) { my $c = shift; warn &Data::Dumper::Concise::DumperF($c, @_); @_ }
TIPS AND TRICKS
global usage
Instead of always just doing:
use Data::Dumper::Concise::Sugar;
Dwarn ...
We tend to do:
perl -MData::Dumper::Concise::Sugar foo.pl
(and then in the perl code:)
::Dwarn ...
That way, if you leave them in and run without the "use Data::Dumper::Concise::Sugar" the program will fail to compile and you are less
likely to check it in by accident. Furthmore it allows that much less friction to add debug messages.
method chaining
One trick which is useful when doing method chaining is the following:
my $foo = Bar->new;
$foo->bar->baz->Data::Dumper::Concise::Sugar::DwarnS->biff;
which is the same as:
my $foo = Bar->new;
(DwarnS $foo->bar->baz)->biff;
SEE ALSO
You probably want Devel::Dwarn, it's the shorter name for this module.
perl v5.18.2 2013-12-31 Data::Dumper::Concise::Sugar(3)