text: user2621: I need to generate a list of unique file names without their extensions or using the shell script command "find"
  Say I have a list such as:
  file2022_col.R1.twx.gz
  file2022_col.R2.twx.gz
  file2022_col.bwa.bam
  file2332_col.R1.twx.gz
  file2332_col.bwa.bam
  file3442_col.bwa.bam.bai
  
  I want a list of unique file names such as:
  file2022_col
  file2332_col
  file3442_col
  
  I'm trying to use find -type f -name but I'm not sure how to construct the option to restrict the find command.
  
  user3848: ls | perl -p -n -e  's/(.*)(\..*){1,3}$/$1/' | uniq
  
  or
  find . -name "file*" | perl -p -n -e  's/(.*)(\..*){1,3}$/$1/' | uniq
  
  find per se is a really powerful command, but its a while since I've used it full functionality.
  
  user6251: Use find, remove all extensions with perl, and make unique with sort:
  find . -type f -printf '%P\n' | perl -pe 's{[.].*}{}' | sort -u
  
  The Perl one-liner uses these command line flags:
  -e : Tells Perl to look for code in-line, instead of in a file.
  -p : Loop over the input one line at a time, assigning it to $_ by default. Add print $_ after each loop iteration.
  s{[.].*}{} : replace [.] (a literal dot), followed by .* (any character repeated 0 or more times) with en empty string.
  SEE ALSO:
  perldoc perlrun: how to execute the Perl interpreter: command line switches
  perldoc perlre: Perl regular expressions (regexes)
  perldoc perlre: Perl regular expressions (regexes): Quantifiers; Character Classes and other Special Escapes; Assertions; Capture groups
  perldoc perlrequick: Perl regular expressions quick start
  
  user15583: It is simpler to use cut command to remove filename extensions:
  ls -1 | cut -d '.' -f1 | sort | uniq
  
  
original_text: 2621: <p>I need to generate a list of unique file names without their extensions or using the shell script command &quot;find&quot;</p>
  <p>Say I have a list such as:</p>
  <pre><code>file2022_col.R1.twx.gz
  file2022_col.R2.twx.gz
  file2022_col.bwa.bam
  file2332_col.R1.twx.gz
  file2332_col.bwa.bam
  file3442_col.bwa.bam.bai
  </code></pre>
  <p>I want a list of unique file names such as:</p>
  <pre><code>file2022_col
  file2332_col
  file3442_col
  </code></pre>
  <p>I'm trying to use <code>find -type f -name</code> but I'm not sure how to construct the option to restrict the find command.</p>
   3848: <pre><code>ls | perl -p -n -e  's/(.*)(\..*){1,3}<span class="math-container">$/$</span>1/' | uniq
  </code></pre>
  <p>or</p>
  <pre><code>find . -name &quot;file*&quot; | perl -p -n -e  's/(.*)(\..*){1,3}<span class="math-container">$/$</span>1/' | uniq
  </code></pre>
  <p><code>find</code> <em>per se</em> is a really powerful command, but its a while since I've used it full functionality.</p>
   6251: <p>Use <a href="https://www.gnu.org/software/findutils/manual/html_mono/find.html" rel="nofollow noreferrer"><code>find</code></a>, remove all extensions with <code>perl</code>, and make unique with <a href="https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html" rel="nofollow noreferrer"><code>sort</code></a>:</p>
  <pre><code>find . -type f -printf '%P\n' | perl -pe 's{[.].*}{}' | sort -u
  </code></pre>
  <p>The Perl one-liner uses these command line flags:<br />
  <code>-e</code> : Tells Perl to look for code in-line, instead of in a file.<br />
  <code>-p</code> : Loop over the input one line at a time, assigning it to <code>$_</code> by default. Add <code>print $_</code> after each loop iteration.</p>
  <p><code>s{[.].*}{}</code> : replace <code>[.]</code> (a literal dot), followed by <code>.*</code> (any character repeated 0 or more times) with en empty string.</p>
  <p><strong>SEE ALSO:</strong><br />
  <a href="https://perldoc.perl.org/perlrun.html#Command-Switches" rel="nofollow noreferrer"><code>perldoc perlrun</code>: how to execute the Perl interpreter: command line switches</a><br />
  <a href="https://perldoc.perl.org/perlre.html" rel="nofollow noreferrer"><code>perldoc perlre</code>: Perl regular expressions (regexes)</a><br />
  <a href="https://perldoc.perl.org/perlre.html#Regular-Expressions" rel="nofollow noreferrer"><code>perldoc perlre</code>: Perl regular expressions (regexes): Quantifiers; Character Classes and other Special Escapes; Assertions; Capture groups</a><br />
  <a href="https://perldoc.perl.org/perlrequick" rel="nofollow noreferrer"><code>perldoc perlrequick</code>: Perl regular expressions quick start</a></p>
   15583: <p>It is simpler to use <code>cut</code> command to remove filename extensions:</p>
  <pre><code>ls -1 | cut -d '.' -f1 | sort | uniq
  </code></pre>
  