Poor Man’s More

Chris Koester has a quick-and-easy file reader in a few lines of C#:

This post describes one way that you can read the top N rows from large text files with C#. This is very useful when working with giant files that are too big to open, but you need to view a portion of them to determine the schema, data types, etc.

I’ve used PowerShell many times to do this with large csv files, but in this example we’re going to use C# and look at the Wikipedia XML dump of pages and articles. The 3017-03-01 dump is very large and comes in at 59.5 GB.

I’ve had to write something similar before on Windows machines where I didn’t have access to more/less.  It’s really helpful for perusing the first few lines of gigantic log files.

Related Posts

Static Site Generation With Hugo

Steph Locke explains how to build a simple site using Hugo: This site uses Hugo. Hugo is a “static site generator” which means you write a bunch of markdown and it generates html. This is great for building simple sites like company leafletware or blogs. You can get Hugo across platforms and on Windows it’s […]

Read More

Using Azure Cloud Shell

Jeffrey Verheul shows off a bit of Azure Cloud Shell: Connecting to a database Now that your Cloud Shell is ready to go, you can start using Bash. This means you can also use sqlcmd from within Bash. You can connect to a database with sqlcmd, by using the following command: sqlcmd -S servername.database.windows.net -U […]

Read More

Categories

March 2017
MTWTFSS
« Feb Apr »
 12345
6789101112
13141516171819
20212223242526
2728293031