Friday, July 2, 2021

Munging Standard Input

I was writing a shell script at work to extract a few lines from from some test output. It wasn't working like I expected so I examined the file: it had Windows-style linebreaks.

Converting "DOS" text files into Unix style is a hall of fame problem that's up there with "how do I rm a file with a name that starts with a minus sign?" and there are several fine solutions. The problem I have is when I run the script I don't want to have to remember do the conversion myself. The script should do it for me!

Here's my first pass:

tr -d '\r' | (
  while read line; do
    echo "Got a line: ${line}"
  done
)

Trust me that my real script did actual work, not just a silly echo. It is also several lines longer.

The tr filters the input stream to Unix-style if it's not already, and then pipes it to the real script action inside parentheses.

CHEERS: The caller doesn't have to convert input. Also works with plain old /bin/sh
JEERS
: Virtually the entire script has to live inside parens

Next I tried process substitution, which is possible with bash and zsh (though not Mac OS /bin/sh):

exec 3< <(tr -d '\r')

while read <&3 line; do
  echo "Got a line: ${line}"
done

CHEERS: The script doesn't need to be wrapped in parens!
JEERS: It has to read from alternate file descriptor 3 instead of STDIN. And it doesn't work with /bin/sh anymore.

How about I replace FD 0 (STDIN) with this new FD 3?

exec 3< <(tr -d '\r')
exec 3>&0

while read line; do
  echo "Got a line: ${line}"
done

CHEERS: The while loop and anything else in the script can just read from STDIN like usual
JEERS: We're still opening up this weird file descriptor 3 what we never use after line 2 directly

How about substituting FD 0 from the start? Will that break anything?

exec 0< <(tr -d '\r')
 

while read line; do
  echo "Got a line: ${line}"
done

CHEERS: No more stray file descriptors
JEERS: The first line is cryptic? Just kidding this is 100% excellent. I see no flaws.

Thursday, May 9, 2019

Surfing with Lee

Here I was sitting in the casino at my psychic's timeshare, when who should walk in but my old friend, a bail bondsman who I haven't heard from since our days in business services and asset management. He'd been in rehab, finished his degree and tells me that he's looking to get involved in medical coding services, or maybe insurance.
He handed me an LP, an archival release of a surf instrumental album Lee Hazelwood made but never released. It's an odd one but I kind of dig it. Is that an early drum machine?

Tuesday, January 15, 2019

SMOKIN': The Best of Brick Smokestack


This 1973 best-of was the final official release from The 'Stack. It also proved to be their best-selling and highest-charting. You may not have had it, but your friend's older brother did. 'Stack it!

Friday, August 17, 2018

HOLD ON! The Best of Joan Bannister

Poet/songwriter Joan Bannister's 1990 contract-fulfiller for Nonesuch. Who can forget all those times she opened for Bruce Cockburn at the Park West for an 'XRT show?


Whole Hog! The Best of Taihu Pig

A close-out bin score from 1988, this is, for most of us, all the Taihu Pig we're ever going to need.

Tuesday, June 13, 2017

Peng!

I ran across this circa 1969-1970 comic that should feel familiar to Stereolab fans:
I think the translation is a bit off. Here's my attempt (with help from Babelfish):
The Deadly Finger

So, you're a stand-up person, you love peace, order and the police…

Worked more than 20 years for the same company, popular with supervisors, no criminal record, no prosecutions.

You joke, yodel, read the Neue Zürcher Zeitung, believe in God and are in the shooting club…

The kids don't like you, especially the long-haired and disobedient, because…

You're a lieutenant in the army!

High time that you're dead!

Bang!

There's a bit more on "Cliff" in this post over at Dangerous Minds.

Tuesday, April 30, 2013

The Reggae Banana Consolation

Has it really been 2 years? I tell ya, cloud computing disaster recovery is worse than online live roulette!

Thursday, September 8, 2011

De Frank & His Professionals



Hey it's been a while. I had invested in a laser skin rejuvenation outfit that went bust almost before it opened. What a mess (literally)! But that's all behind me now. At least my skin is laser rejuvenated, I guess.

My buddy who is a car accident lawyer in Idaho was telling me the other day how he's done with Euro-centric music. Since he includes the descendants of Europeans living in North America, he's cut himself off from the mainstream. Is that so bad? His thing now is buying rare records and cassettes from Africa. He's become big fan of De Frank Professionals (or was it De Frank and His Professionals?) from Togo. Little of this stuff is digital so it's nice that some of it made it to the youtube. No way I'd be hearing this stuff otherwise. My buddy keeps sending me tapes, but my only cassette deck is in my old Chevy Malibu, which I rarely drive. Plus I'm pretty sure it's busted. It's never been the same after that drunk driver plowed into it at the SeaTac parking lot.

Tuesday, January 4, 2011

Rodan's Everyday World of Bodies

I was fortunate enough to see Rodan twice during their way-too-short existence, both times at Lounge Ax in 1994. This video was from a show in Athens, GA that same year and, well it turns out you didn't have to be there: you can watch this and you'll get why it was so disappointing when they broke up. Yes, Rodan's breakup was the most tragic of 1994, beating both Nirvana and Unrest. Why? Because Rodan was just getting started. It's like, what if My Bloody Valentine gave up after making "Isn't Anything"? Or if Pavement made no records after "Perfect Sound Forever". You know what I mean?




In the mean time, it's back to San Jose for more liposuction for me!

Monday, November 8, 2010

Back to Back to the Egg

I was talking to my buddy the other day, when the topic of Wings' ill-fated 1979 LP "Back to the Egg" came up. He's a personal injury attorney in Detroit, so he's well-acquainted with mishaps. Looking back, I think the "disasters" associated with "Back to the Egg" were mostly external, like Paul's pot bust in Japan and the band's breakup. Listening to what's actually on the record, I don't see what's so bad about it. Maybe I can chalk it up to familiarity.



I heard the album start-to-finish for the first time only recently when I picked it up on used vinyl. It was uncanny: I already knew this entire album. Every track on this thing must have gotten played on AOR radio enough that everything was familiar. Kind of like the Eagles' "The Long Run" or the first Boston album. The difference here is that the Boston and Eagles tracks are still in regular rotation on Classic Rock stations to this day. I don't know about "Back to the Egg," outside maybe "Rockestra Theme".



Here's a 1976 demo of one of those "Back to the Egg" non-hits, "Old Siam Sir":


Monday, April 26, 2010

Husker Du on "Good Company" April 1986

Been a while! You head to Cincinatti for a weekend, and on a whim get some liposuction. A weekend turns into a week, a week turns into 6... you know how it goes.



Do you remember seeing Husker Du on a local morning TV show back in 1986? I sure don't, but then I've never lived in or near the "twin cities". You?



Friday, January 15, 2010

Friday Playlist: An Ugly Death, It's So Easy

Reviving the "Friday Playlist" for the late Jay Reatard. Here he is with his what will be known as his "classic" touring band lineup running through two of my favorites just over a year ago:



Friday, October 16, 2009

Friday Playlist: Competent Drumwork

There's a certain something about people who broke big out of Michigan. Think of Iggy & the Stooges, Barry Gordy, Madonna, Ted Nugent, Thomas Edison, Funkadelic, Michael Moore, Jack Kevorkian, the White Panthers and the MC5. Few states can compete with that.

Add Flint's Grand Funk Railroad to that list. Given this is a Youtube clip, the bass won't be rattling any bongs, but it's remarkable nonetheless. Given this is 10 minutes long it's a playlist of one. If you make it through the whole thing, you'll agree that's more than enough. It starts paying off about halfway through.

[ When this post gets translated into a Facebook note, what will happen to the Flash embed? You might need to click over to Junk Nexus to see it. ]

Friday, October 9, 2009

Shallow thoughts re: Decemberists show Oct 8, 2009

The sound was great. This was my first indoor rock show without earplugs in probably 17 years. No (tobacco) smoke, no tinnitus, and back home by 11 PM. Pleasant!

The 50+ crowd was out in force, as were kids with glasses. Chicago Police were on hand and there were no arrests.

I did not expect them to play the whole new album "Dark Side of the Moon"-style.
I am dense.

You may remember all the Neutral Milk Hotel comparisons this band used to get. I've seen NMH (twice!) and the Decemberists put on a much, much better show than NMH.

You may remember all the Jethro Tull comparisons this band still gets. I haven't seen Tull (ever!) and I didn't think about Tull at all during this show. I still hear some Tull in "The Crane Wife" though.

This is only my 4th visit to the Riviera, and it's always an Event: Sonic Youth/Royal Trux 1992, Kraftwerk 1998 (first Chicago show since the early 80s), Wilco 2008 (final night of their play-everything 5 night stand). Kraftwerk still may be my favorite of the 4, but it's close now.

Friday, September 4, 2009

Friday Playlist: JOURNEY

The theme for the Shermerville 3rd/4th grade girls soccer team names this fall is rock bands. We got Journey. Though I have no Journey records, I am familiar enough with their music to know their Greatest Hits album from the late 80s is kind of weak. This playlist is, if nothing else, less weak.

Picking a song to start the playlist was tough, since most Journey songs sound like they would make good 2nd songs. So I punted and went with one that the band themselves chose as a leadoff on one of their albums. Check out that last sentence: football and baseball allusions, but no soccer ones. The final song was easy to pick, because it's obligatory, but you have to listen to a long prog/jazz instrumental named after a comet before you get to it.

http://listen.grooveshark.com/#/playlist/JOURNEY/16343591

Friday, August 14, 2009

Friday Playlist: NEU!

The truth about most of these "Friday Playlists" is I don't usually play them on Fridays when I post them. I usually find it hard to work while listening to music with vocals. This week's playlist is the (nearly) all-instrumental 1972 debut album from everybody's 2nd or 3rd favorite "krautrock" band, NEU! I actually listened to it this afternoon.

http://listen.grooveshark.com/#/playlist/NEU_/15254892

Friday, July 31, 2009

Friday Playlist: 15 "Random" Songs

Bernie tagged me on Facebook with one of those post-your-first-15-songs-on-shuffle notes. Here's my contribution, as a Grooveshark playlist. The instructions said no cheating, but I skipped songs that are on my iPod but aren't on Grooveshark. I could upload them, but I'm not putting in that much effort today. You can think this is a milder, digital equivalent of 78 snobs who seek out rare records just so they can smash them (meaning nobody else can have them, making their own copies that much more valuable) but you'd be wrong. So this is something like the first 20 or so, whittled down to the 15 I could find.

http://listen.grooveshark.com/#/playlist/15_Random_Songs/13155714

Friday, July 24, 2009

Friday Playlist: Droning, shapeless indifference

I was listening to my dehumidifier and realized it sounds sort of like Lou Reed's most hated and misunderstood album, "Metal Machine Music". I have this one on 8 track, and this is supposedly its ideal format (that might be a joke, but MMM itself might be a joke). You're stuck with a streaming mp3 approximation from Grooveshark:

http://listen.grooveshark.com/#/playlist/Lou_Reed_Metal_Machine_Music/12104555

Friday, July 17, 2009

Friday Playlist: Foxsploitation

Given it's Pitchfork Fest weekend, this week's playlist is related to last year's Pitchfork sensation Fleet Foxes. You know Fleet Foxes, right? I found their CD at Target so it's not like they're some obscure band.

One of the Fleet Foxes, Robin Pecknold, played a solo show last weekend in Seattle, and because it's 2009 somebody put it on the Internet almost immediately afterward.

Aside from a few FF songs, he threw renditions of songs by the Magnetic Fields, Fleetwood Mac (one from the Peter Green era, another from Rumours), Nilsson, and Neutral Milk Hotel into his set. For the older folks out there, that's the modern-day equivalent of a band covering the Velvet Underground, the 1910 Fruitgum Company, and The Gay Bob Dylan or something.

It's free, and (apparently) authorized:

http://www.soundonthesound.com/2009/07/13/getting-drunk-for-the-kids-with-robin-pecknold/