title: How can I extract a substring from the results of a cut command in unix?
body: <p>I have a file that is '|' delimited. One of the fields within the file is a time stamp. The field is in the following format: <code>MM-dd-yyyy HH:mm:ss</code> I'd like to be able to print to a file unique dates. I can use the cut command (<code>cut -f1 -d'|' _file_name_ |sort|uniq</code>) to extract unique dates. However, with the time portion of the field, I'm seeing hundreds of results. After I run the cut command, I'd like to take the substring of the first eleven characters to display unique dates. I tried using an awk command such as:
      <code>awk ' { print substr($1,1-11) }' | cut -f1 -d'|' _file_name_ |sort|uniq &gt; _output_file_</code></p>
  
  <p>I'm having no luck. Am I going about this the wrong way? Is there a more simple way of extracting the data I need. Any help would be appreciated.</p>