Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'useless use of hold space' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
useless use of hold space
Authored by: ChrisR on Apr 09, '04 09:55:14AM

The use of the hold space in the above code is completely unnecessary. Here's how the script should look:


#n
s/^CD_DA$/CD_DA\
/p
/^TRACK AUDIO$/p
/^FILE/{
N
s/\(.*\)\n\(.*\)/\2\
\1/
s/^\n\(.*\)/\1/
s/^START/PREGAP/
s/FILE "\(.*\)".*/FILE "\1" 0\
/p
}

Run the script with 'sed -f SEDSCRIPT > TOCFILE'

[ Reply to This | # ]

final update
Authored by: ChrisR on Apr 12, '04 09:32:05PM

Okay, here's my final update to the striptoc script. I ported it over to awk so that I could bring in a listing of flac files from the current directory.


#!/usr/bin/awk -f
BEGIN { print "CD_DA\n" }
{ FS = "\n"; RS = ""
  if ($2 == "TRACK AUDIO") {
    print $2
    if ($NF ~ /^START/) { 
      sub(/^START/, "PREGAP", $NF)
      print $NF
    }
    FS = " "; RS = "\n"
    "ls *.flac" | getline file
    sub(/flac$/, "wav", file)
    print "FILE \"" file "\" 0\n"
  }
}


[ Reply to This | # ]