mirror of
https://github.com/jbranchaud/til
synced 2026-01-07 00:58:02 +00:00
Add Produce A Lowercase V4 UUID as a Unix TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1334 TILs and counting..._
|
_1335 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1322,6 +1322,7 @@ _1334 TILs and counting..._
|
|||||||
- [Print Milliseconds In Human-Readable Format](unix/print-milliseconds-in-human-readable-format.md)
|
- [Print Milliseconds In Human-Readable Format](unix/print-milliseconds-in-human-readable-format.md)
|
||||||
- [Print Out Files In Reverse](unix/print-out-files-in-reverse.md)
|
- [Print Out Files In Reverse](unix/print-out-files-in-reverse.md)
|
||||||
- [Print The Current Date In Human-Readable Format](unix/print-the-current-date-in-human-readable-format.md)
|
- [Print The Current Date In Human-Readable Format](unix/print-the-current-date-in-human-readable-format.md)
|
||||||
|
- [Produce A Lowercase V4 UUID](unix/produce-a-lowercase-v4-uuid.md)
|
||||||
- [Provide A Fallback Value For Unset Parameter](unix/provide-a-fallback-value-for-unset-parameter.md)
|
- [Provide A Fallback Value For Unset Parameter](unix/provide-a-fallback-value-for-unset-parameter.md)
|
||||||
- [Remove A Directory Called `-p`](unix/remove-a-directory-called-dash-p.md)
|
- [Remove A Directory Called `-p`](unix/remove-a-directory-called-dash-p.md)
|
||||||
- [Repeat Yourself](unix/repeat-yourself.md)
|
- [Repeat Yourself](unix/repeat-yourself.md)
|
||||||
|
|||||||
26
unix/produce-a-lowercase-v4-uuid.md
Normal file
26
unix/produce-a-lowercase-v4-uuid.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Produce A Lowercase V4 UUID
|
||||||
|
|
||||||
|
There are [a variety of ways to produce a v4
|
||||||
|
UUID](different-ways-to-generate-a-v4-uuid.md) on Unix-based machines. Of the
|
||||||
|
options I listed in that post, my favorite is the `uuidgen` command. My only
|
||||||
|
gripe with it is that it produces an all uppercase UUID.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ uuidgen
|
||||||
|
B7918C26-12AE-4093-B6DA-0D7D41C59FB6
|
||||||
|
```
|
||||||
|
|
||||||
|
Often when I need a UUID, it is to plug in as the ID value for some test data
|
||||||
|
in a system that is using lowercase UUIDs. For the sake of consistency, I'd
|
||||||
|
like it to be lowercase as well.
|
||||||
|
|
||||||
|
The `tr` command comes in handy for this because I can _tr_anslate the
|
||||||
|
uppercase characters to lowercase ones.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ uuidgen | tr '[:upper:]' '[:lower:]'
|
||||||
|
ed817cf3-8f70-4838-82bc-8e5b328c0b93
|
||||||
|
```
|
||||||
|
|
||||||
|
So now anytime I need a lowercase UUID, I hit `ctrl-r` and search back for
|
||||||
|
either `uuid` or `lower` and find this command pretty quickly.
|
||||||
Reference in New Issue
Block a user