He and she

petdance on 2003-10-28T20:17:44

You know what not to do, but what's she all about? Here's what my iTunes has to say about her:

  • She Blinded Me With Science
  • She Can't Dance
  • She Loves You
  • She Makes Me (Stormtrooper In Stilettos)
  • She May Be Yours (But She Comes To See Me Sometime)
  • She Said She Said
  • She Sells
  • She Thinks I Still Care
  • She Walks
  • She's a Woman
  • She's Always A Woman
  • She's Gone
  • She's Got You
  • She's Leaving Home
  • She's Moving To Paris
  • She's My Ex
  • She's Not For You


iTunes has less to say about him:

  • He Gives Us All His Love
  • He Stopped Loving Her Today
  • He Turned The Water Into Wine
  • He'll Be A Friend
  • He'll Have To Go
  • He's a Whore
  • He's Got A Secret
  • He's Misstra Know It All


On the fly text mangling

petdance on 2003-10-28T20:20:16

For the code junkies, I cut'n'pasted the lines from my iTunes list into a temp file, where they're tab-separated, and unsorted:
$ cat > foo
He's a Whore    1 of 1  3 of 10 2:42    Cheap Trick     Cheap Trick     1977    7       10/24/03 4:55 PM
He's Misstra Know It All        1 of 1  9 of 9  5:35    Stevie Wonder   Innervisions    1973    4       6/17/03 3:24 PM
He Stopped Loving Her Today     1 of 1  1 of 14 3:19    George Jones    I Am What I Am  1980    7       7/15/03 5:15 PM
He Gives Us All His Love        1 of 1  3 of 12 1:56    Randy Newman    Sail Away       1972    5       8/12/03 11:59 AM
He'll Be A Friend       1 of 1  11 of 13        2:00    Johnny Cash     Hymns By Johnny Cash    1958    5       10/2/03 2:19 PM
He Turned The Water Into Wine   1 of 1  15 of 18        4:01    Johnny Cash     At San Quentin (The Complete 1969 Concert)      2000    6       6/2/03 9:00 AM
He'll Have To Go        1 of 2  14 of 15        4:33    Elvis Presley   The Elvis Presley Collection - Country  1998
He Turned The Water Into Wine   1 of 1  22 of 26        3:16    Johnny Cash     At Madison Square Garden        2002    1       8/27/03 3:36 PM
He's Got A Secret       1 of 1  9 of 11 2:42    Bangles All Over The Place      1984
and then did some command-line stuff to get the first column:
$ perl -nal -F'\t' -e'print "<LI>$F[0]"' -l foo | sort -f

perl--

Dom2 on 2003-10-28T20:55:24

I don't like using perl when there are easier ways. :-)
$ cut -f1 foo | sed 's/^/<li>/' | sort -f

-Dom

It's all about the tools....

petdance on 2003-10-28T21:24:36

Yeah, but 1) I don't know sed, and 2) I do know Perl very well. I realize learning sed isn't a very long trip from Perl, but it's all about the tools you have handy...

Re:It's all about the tools....

Dom2 on 2003-10-28T21:32:12

There's not much to learn about sed. Just "s/foo/bar/g" just like perl. cut is the more interesting (and IMHO) underused tool.

OTOH, you know you're doing too much shell scripting when you find regular uses for join(1). :-)

-Dom

Re:It's all about the tools....

ziggy on 2003-10-30T16:07:16

There's a lot more to sed than "s/foo/bar/g". I'm forever doing ranges like 1,/--8 or whatnot.

Arguing over sed vs. perl is like arguing over which manufacturer produces the definitive Swiss Army Knife. Sure there are differences, and either one will let you get your job done pretty damn quickly. In situations like this, the differences are moot.

Just so long as you don't break down and write a Java program to do the same thing. ;-)

Cheap Trick?

djberg96 on 2003-10-28T21:46:24

What happened to "She's Tight"? :-P

Re:Cheap Trick?

petdance on 2003-10-28T22:42:27

oooh, good idea. I'll need to bring my copy of the Sex, America, Cheap Trick box set in and rip it.

The iTunes here at work is just what I've ripped from my collection at home...