Skip to content

Instantly share code, notes, and snippets.

@0xdevalias
Last active May 10, 2024 01:09
Show Gist options
  • Save 0xdevalias/0b56aef69e20bfcbf0f1eed3960f4db8 to your computer and use it in GitHub Desktop.
Save 0xdevalias/0b56aef69e20bfcbf0f1eed3960f4db8 to your computer and use it in GitHub Desktop.
A few little scripts for sorting Twitter URLs and similar things

Sorting Twitter URLs

A few little scripts for sorting Twitter URLs and similar things.

Table of Contents

Overview

Original source: https://twitter.com/_devalias/status/1788459969857351705


Given a list of Twitter URLs like:

https://twitter.com/userA/status/123453
https://twitter.com/userB/status/123465
https://twitter.com/userA/status/123450

We can sort them by tweetID like this:

⇒ pbpaste | sort -t '/' -k 6n

https://twitter.com/userA/status/123450
https://twitter.com/userA/status/123453
https://twitter.com/userB/status/123465

Or sort/batch them by userID, and then tweetID like this:

⇒ pbpaste | sort -t '/' -k 4,4 -k 6n | awk -F'/' '{if (last && $4 != last) print ""; last=$4; print $0}'

https://twitter.com/userA/status/123450
https://twitter.com/userA/status/123453

https://twitter.com/userB/status/123465

This can then assist in reviewing/working through a backlog of tweets while reducing the impact of 'cognitive context switching'.

See Also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment