Created
August 1, 2012 15:07
-
-
Save takeshik/3227633 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
File.ReadLines("a.log").ForEach(delegate(string $0) | |
{ | |
Console.WriteLine($0); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
( | |
from $0 in ( | |
from $0 in File.ReadLines("a.log") | |
select int.Parse($0.Split(new char[] | |
{ | |
(char)44 | |
})[2])).Distinct<int>() | |
where $0 >= 10 | |
orderby $0 | |
select $0).ForEach(delegate(int $0) | |
{ | |
Console.WriteLine($0); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
File.ReadLines("a.log").Select(delegate(string $0) | |
{ | |
string[] array = $0.Split(new char[] | |
{ | |
(char)44 | |
}); | |
return string.Concat(new string[] | |
{ | |
array[0], | |
",", | |
array[3] | |
}); | |
}).ForEach(delegate(string $0) | |
{ | |
Console.WriteLine($0); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
File.ReadLines("a.log").Where(delegate(string $0) | |
{ | |
string a = $0.Split(new char[] | |
{ | |
(char)44 | |
})[0]; | |
return a == "server4"; | |
}).ForEach(delegate(string $0) | |
{ | |
Console.WriteLine($0); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
Console.WriteLine(File.ReadLines("a.log").Count<string>()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
( | |
from $0 in ( | |
from $0 in File.ReadLines("a.log") | |
select $0.Split(new char[] | |
{ | |
(char)44 | |
}) into $0 | |
orderby $0[0], int.Parse($0[2]) | |
select $0).Take(5) | |
select string.Join(",", $0)).ForEach(delegate(string $0) | |
{ | |
Console.WriteLine($0); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
Console.WriteLine(File.ReadLines("a.log").Distinct<string>().Count<string>()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
Console.WriteLine(File.ReadLines("a.log").Distinct((string $0) => $0.Split(new char[] | |
{ | |
(char)44 | |
})[2]).Count<string>()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
IGrouping<string, string> source = ( | |
from $0 in File.ReadLines("a.log") | |
select $0.Split(new char[] | |
{ | |
(char)44 | |
})[3] into $0 | |
group $0 by $0 into $0 | |
orderby $0.Count<string>() descending | |
select $0).First<IGrouping<string, string>>(); | |
string value = string.Concat(new object[] | |
{ | |
source.Count<string>(), | |
" ", | |
source.First<string>() | |
}); | |
Console.WriteLine(value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :Program.:Impl | |
internal static void <Main>:Impl() | |
{ | |
( | |
from $0 in File.ReadLines("a.log").Select(delegate(string $0) | |
{ | |
string text = $0.Split(new char[] | |
{ | |
(char)44 | |
})[0]; | |
return text.Replace("server", "xxx"); | |
}) | |
group $0 by $0 into $0 | |
select string.Concat(new object[] | |
{ | |
$0.Count<string>(), | |
" ", | |
$0.First<string>() | |
})).ForEach(delegate(string $0) | |
{ | |
Console.WriteLine($0); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment