Today, I wanted to make a module for my AwesomeWM status bar that shows the currently playing Spotify song, it’d be nice if it could show something

Linux text manipulation

submited by
Style Pass
2024-03-28 12:30:09

Today, I wanted to make a module for my AwesomeWM status bar that shows the currently playing Spotify song, it’d be nice if it could show something human-readable like this: Wild World by Yusuf/Cat Stevens.

I could ask chatgpt to format this or write a Lua script, but that wouldn’t be much fun, would it? in this article, we’ll learn how to use awk, sed and other commands to get the desired output. Intended Audience this is intended for people who have used Linux but are otherwise new to the terminal, if you’ve at least created a file from the command line, you’re good to go, I’ll cover everything else throughout the article

If you want to follow along, download the bash script, and experiment with the commands we’ll learn, but that’s not required per se.

To get started sp current returns the album name, album artist, song artist, and song title, whereas we only need the artist and title. we can use sed to pick the specific lines we need.

Leave a Comment