{
"$type": "site.standard.document",
"canonicalUrl": "https://justingarrison.com/blog/2024-01-06-nu-shell-is-cool",
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreiaezu3nycj3lhzxicu33zp2kwnmbunaksef7akeefmgjuuht3dq64"
},
"mimeType": "image/png",
"size": 112935
},
"description": "Converting a file is a common task and nu shell was the most intuitive way to do it.",
"path": "/blog/2024-01-06-nu-shell-is-cool",
"publishedAt": "2024-01-06T08:49:06.000Z",
"site": "at://did:plc:p7uix7mresfq4nfzxp3klgfa/site.standard.publication/3mmdn7mg2qm2d",
"textContent": "I had a csv file with data that looked like this.\n\nAnd I needed to convert the date field into this:\n\nI tried to do this with awk first because it seemed like it would be a good fit.\nI'm sure it's possible but the syntax is obscure and I couldn't figure it out.\n\nI ended up with something like this (not working):\n\nWhen I can't get something in a single for loop or a few pipes I'll reach for a general purpose programming language.\nSo I fired up iPython and wrote this to convert the file.\n\nThis works but it was more verbose than I wanted.\nI'm sure there's other ways to do it, but it felt like something I should be able to do in my shell.\n\nFinally, I tried it with nu:\n\nIt was a more elegant and readable solution.\nI'm very impressed with how far nu has come and thankful for their helpful community who helped me quickly figure this out.",
"title": "Nu Shell Is Cool"
}