Category: Blog

  • Creating TAIL on Windows for Text Files

    UPDATE: Article changed based on the comment from Mr. Sewell.

    I wrote recently about making a HEAD utility to find the top few lines from a text file. I used Powershell and scripting to make this work from any Windows command line on my machine.

    Someone asked about TAIL, which is easy, so I did this as well and set up a tail utility.

    Get-Content in Powershell will do this, so I took my head.cmd and did a save as in VS Code.

    2022-08-15 15_02_49-Save As

    Then I changed the “first” in the code to “last”, as shown here.

    UPDATE: Based on a comment from Mr. Sewell, I updated the code.

    There is a tail parameter for Get-Content, so let’s use that.

    powershell "get-content %1 -tail 10 | select-object"

    This gets me the end of a file. As an example this is below. Here’s a text file I have with various values. As you can see below, the bottom values are zeros.

    2022-08-15 15_19_39-D__Downloads_Chart Export 08_15_2022 21_19.csv - Sublime Text (LICENSE UPGRADE R

    Here’s my tail utility working:

    2022-08-15 15_23_49-D__Downloads

    UPDATE: I left the original piece below in italics, but with the tail parameter, this takes a few seconds.

    If I run this on a larger, 1.5GB file, it takes a few seconds.

    tail parameter change and quick execution

    In case you’re wondering how this works on larger files, it can be slow. This took 3 minutes on my machine to get the last ten lines of a 1.5GB file.

    2022-08-15 15_28_58-D__Downloads_imdb

  • Daily Coping 17 Aug 2022

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to check in with someone who may be lonely or feeling anxious.

    I check in with my Mom regularly, as she does live alone. However, she’s not usually anxious about things. On the other hand, I have had a friend that has struggled the last few years. Some health issues, some employment challenges, and then personal struggles. I’ve made it a point to periodically just reach out.

    I did this again this week, just to see how they were feeling and if they were coping with life. I don’t think they’re lonely or anxious anymore, but it’s good to check.

  • Daily Coping 16 Aug 2022

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to thank someone you’re grateful to and tell them why.

    One of the things I’ve seen recently is a thank you series from Grant, letting people know how he appreciates them in his life. I like that, and he’s made some nice choices. All of those people have impacted my life as well.

    While I have many people, I’m choosing one for this post. Erin Stellato is someone I’ve known a long time. I don’t know exactly when we met, but I have many memories:

    • Being a gracious host at a Cleveland SQL Saturday and hanging out with her and her daughter by the slide in the building.
    • Sitting in the lobby of the Seattle convention center chatting about something SQL Server.
    • Doing yoga together in a class before some event
    • Skiing with her family and grandfather in Colorado
    • running through the streets of Bellevue in the morning before the MVP Summit

    Lately, however, I’m really grateful for some counsel from her on diversity and harassment issues. These are not pervasive, but they are present in the SQL Community (and others). My perspective and view is limited, and I have asked others for help in finding a way forward to prevent future incidents. Erin has been great about listening and give me things to think about.

    I’m really grateful for her help on a very difficult topic.

    I’m also grateful for her friendship and hope we find time for some future yoga, skiing, or some other fun activity.