AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() ![]() I give the file the name snatchmail, open it up in vim, and paste my command. Whenever I have a long command or chain of commands such as this one, I find it easiest to create a file for the command and place it in the bin directory of my home folder, which I have already conveniently mapped to my $PATH. I also dont care about validating the email addresses. ![]() Pretty neat, huh? It is, yeah, and my end result was a nicely ordered one-to-a-line file of every unique email address, ready to be copy/pasted into the 'to' line of a new email.īut it's waaaay too damned long to remember. ![]() the > at the end just before the output file tells zsh to push that output into vwc-emails.txt. We then pipe ( |) that output into sort and uniq to get them alphabetized and remove duplicates. Is my grep command, in which I tell grep to output the results of using the included regex command on the aforementioned input file. Grep -o slack-export-privategroup-T1603Z.json The following snippet proved more than able to accomplish exactly the task I needed done, in a little under a second: how do we write a script to do this instead? However, anyone who's ever read one of my posts before or dealt with me in person knows that I am most definitely not a patient man, nor am I a man that has an abundance of free time. This means, were I a more patient man, I'd go through each of those by hand and manually cut-and-paste each email address individually into a separate form. in other words, the key-value pairs from each application that render nicely in the 'apply-forms' channel all come out as one long string. However, the JSON that it spits out is relevant to generic messages, not messages that are broken down into what could be a further JSON object. pretty handy when you get behind on answering applications. We also have a slack app called 'export' that will export every message from a given slack channel between two given dates to JSON format. VWC has a channel to which every application gets piped in our Slack group, called 'apply-forms'. My task today was to take an exported set of applications I receive over the apply-forms channel in the VWC slack group and grab all the email addresses out of it, so I could perform one single mass mailing. if I need a long command or series of commands to accomplish a task more than once, my instinct is to take that command and turn it into an easy to remember, re-usable script. ![]()
0 Comments
Read More
Leave a Reply. |