Creative Commons License R.Muralikrishnan, MPI for Empirical Aesthetics. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Licence.
#! /usr/bin/awk -f
#Om
#################################################
# AWK Script to generate a wide-format cues file
# from allcues_filtered.out.
# This script replaces cues.pl we used earlier.
#
# Execute as: awk -f Cues-File-For-Acoustic-Analysis.awk ../Cues/allcues_filtered.out > Cues-File.out
#
# Author: R.Muralikrishnan
#################################################

BEGINFILE{

  # Print a header line in the beginning
  print "Wavefile\tItem\tCond\tMF\tWO\tDet1On\tDet1Off\tN1On\tN1Off\tVPOn\tVPOff\tDet2On\tDet2Off\tN2On\tN2Off";

}

{

  if ($4=="Cue-1") # Then we're starting with a new stimulus
  {
    printf $1"\t"$2"\t"substr($1,3,3)"\t"substr($1,3,1)"\t"substr($1,4,2);

  }

  printf "\t"$5;

  if ($4=="Cue-10") # Then the stimulus ends here
  {

    printf "\n";

  }

}