blob: 736cbb1087b643f39f05216e9015856145030ca0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
Task 1: "Sort Email Addresses
Write a script that takes a list of email addresses (one per line) and sorts them first by the domain part of the email address, and then by the part to the left of the @ (known as the mailbox).
Note that the domain is case-insensitive, while the mailbox part is case sensitive. (Some email providers choose to ignore case, but that’s another matter entirely.)
If your script is invoked with arguments, it should treat them as file names and read them in order, otherwise your script should read email addresses from standard input.
Bonus
Add a -u option which only includes unique email addresses in the output, just like sort -u.
Example
If given the following list:
name@example.org
rjt@cpan.org
Name@example.org
rjt@CPAN.org
user@alpha.example.org
Your script (without -u) would return:
user@alpha.example.org
rjt@cpan.org
rjt@CPAN.org
Name@example.org
name@example.org
With -u, the script would return:
user@alpha.example.org
rjt@CPAN.org
Name@example.org
name@example.org
"
My notes: cool question. Will have a go!
Task 2: "N Queens - in 3D..
"
My notes: sorry, I'm rather busy, sounds like a horrible problem, not doing it.
|