Zum Hauptinhalt springen
YouTube Security VideosXDA: I turned my iPhone Duo into a retro gaming PC(04.11.2026 um 09:34 Uhr)
•
YouTube Security Videos.NET Foundation: .NET Conf 2026 Community Day 2(03.11.2026 um 21:21 Uhr)
••••
YouTube Security VideosTesla: Flight POV | Roadster(03.11.2026 um 23:59 Uhr)
•
YouTube Security VideosA new way to use GitHub Copilot in JetBrains IDEs(03.11.2026 um 21:38 Uhr)
•
YouTube Security VideosGitHub: Open Source Friday: pgmq(03.11.2026 um 23:11 Uhr)
•••
YouTube Security VideosXDA: I turned my iPhone Duo into a retro gaming PC(04.11.2026 um 09:34 Uhr)
•
YouTube Security Videos.NET Foundation: .NET Conf 2026 Community Day 2(03.11.2026 um 21:21 Uhr)
••••
YouTube Security VideosTesla: Flight POV | Roadster(03.11.2026 um 23:59 Uhr)
•
YouTube Security VideosA new way to use GitHub Copilot in JetBrains IDEs(03.11.2026 um 21:38 Uhr)
•
YouTube Security VideosGitHub: Open Source Friday: pgmq(03.11.2026 um 23:11 Uhr)
•••
Intelligence View
⚡ tsecurity.de Intelligence

HPR4763: Solving anagrams with bash

This show has been flagged as Clean by the host. The Dutch Railway Company occasionally has a anagram of the names of the railway stations on their services.…

Beitrag
0
Seite
0
↗ Quelle (Hacker Public Radio)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

This show has been flagged as Clean by the host.




The
Dutch Railway Company

occasionally has a anagram of the names of the railway stations on their services.






















The image above shows which service we are on, namely the intercity direct to
Breda

via
Schiphol Airport

, and the time is 07:27.







It shows a cartoon depiction of a platform where the information sign is displaying the letters of the anagram, and today it reads "Nul Te Teer".







Under it says "Oops, the letters are mixed up. Can you guess the correct station ?"







The under it says that the next station at 07:38 will be
Duivendrecht

.









I wrote a script to check my guess. It consists of a function normalise_word, which takes any word, removes everything but the letters, and then converts it to lower case. Each letter is printed to it's own line, where it's sorted, and new lines are removed, to be printed as a "normalised" word.








This is used to take the
List of Dutch Railway Stations from Wikipedia

, to produce a list of stations and convert them to normalized names which is saved to a new file with the normalised names on the same line as the real names.








We can then just grep for the normalised version of the anagram and whatever line it was found in the normalised file, should correspond to the same line in the real file.








"Nul Te Teer" gets converted to "eeelnrttu" which is found in the normalised file, and that corresponds to "
Etten-Leur

"










Tell us how would you solve it ?









#!/bin/bash
# Ken Fallon - CC-0/Public Domain

station_file="ns-train-stations.txt"

# Get the station name
if [ "$#" -lt 1 ]
then
echo "ERROR: Please specify station"
exit 1
fi

function normalise_word() {
printf '%sn' "${1}"
| tr --delete --complement 'A-Za-zn'
| tr '[:upper:]' '[:lower:]'
| grep --only-matching --regexp='.'
| sort --ignore-case
| tr --delete 'n'
printf 'n'
}

station="$( normalise_word "${1}" )"

cat ${station_file} | while read word
do
normalise_word "${word}"
done > "${station_file%.*}_normalised.txt"

linenumber="$( grep --line-number --perl-regexp "^${station}$" "${station_file%.*}_normalised.txt" | awk -F ':' '{print $1}' )"

sed --quiet "${linenumber}p" ${station_file}












Provide feedback on this episode.

Intelligence Digest gratis Dagelijks het belangrijkste beveiligingsnieuws · kan op elk moment worden opgehaald
Community Rating & Social Proof
⭐ Leser-Wertung
–
Ø / 5.0
Nog geen recensies van lezers
Was deze pagina nuttig?
0
Jetzt Bewertung abgeben
🟢 Niedrig (1-3.9) 🟡 Mittel (4.0-6.9) 🔴 Hoch (7.0-8.9) Kritisch (9.0-10.0)

Verwant Story Cluster & Sources (vector AI)

Trek om te vernieuwen
Nächster Beitrag