Skip to content

Instantly share code, notes, and snippets.

@takeshik
Created August 1, 2012 15:07
Show Gist options
  • Save takeshik/3227633 to your computer and use it in GitHub Desktop.
Save takeshik/3227633 to your computer and use it in GitHub Desktop.
// :Program.:Impl
internal static void <Main>:Impl()
{
File.ReadLines("a.log").ForEach(delegate(string $0)
{
Console.WriteLine($0);
});
}
// :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);
});
}
// :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);
});
}
// :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);
});
}
// :Program.:Impl
internal static void <Main>:Impl()
{
Console.WriteLine(File.ReadLines("a.log").Count<string>());
}
// :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);
});
}
// :Program.:Impl
internal static void <Main>:Impl()
{
Console.WriteLine(File.ReadLines("a.log").Distinct<string>().Count<string>());
}
// :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>());
}
// :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);
}
// :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