<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: perl help/excel/delete in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421620#M71271</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;what do mean by random?&lt;BR /&gt;You can select with CTRL+mouseclick and number of files in your excel sheet, create the filelist and use mv instead of rm in the script.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
    <pubDate>Mon, 15 Nov 2004 08:15:11 GMT</pubDate>
    <dc:creator>Michael Schulte zur Sur</dc:creator>
    <dc:date>2004-11-15T08:15:11Z</dc:date>
    <item>
      <title>perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421613#M71264</link>
      <description>I have over 4000k .pdf files that I need to filter for the right type (i.e. Personal, Business, Notes, Report).  I have an excel file that lists all the file names and the associated type.  What I am trying to do is get all the files that are type ‘Notes’ and ‘Personal’ and delete the others.  Once I have types ‘Notes’ and ‘Personal’ from that bunch I want to randomly select (and cut) 1000 files and put them in a new folder.  Can this be done using perl? &lt;BR /&gt;</description>
      <pubDate>Sat, 13 Nov 2004 21:18:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421613#M71264</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-13T21:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421614#M71265</link>
      <description>use cut and paste and vi to create a simple filelist, one line per file.&lt;BR /&gt;&lt;BR /&gt;put the file inot Linux(we are in linuxland).&lt;BR /&gt;&lt;BR /&gt;while read -r filename&lt;BR /&gt;do&lt;BR /&gt;  rm -f $filename&lt;BR /&gt;done &amp;lt; filelist&lt;BR /&gt;&lt;BR /&gt;That will nuke them all and fast.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Sun, 14 Nov 2004 01:16:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421614#M71265</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-11-14T01:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421615#M71266</link>
      <description>Do I have to assign the file name path?  I am guessing this is a shell script that you told me to write.&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Nov 2004 01:29:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421615#M71266</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-14T01:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421616#M71267</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Sep said to cut and paste the filenames fro your excel sheet and create a file with it then create the script he posted and let it run in the same dir as your filelist. If you do only have relative filenames than you will have to put both files at the top of your filenames path.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Nov 2004 03:24:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421616#M71267</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-11-14T03:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421617#M71268</link>
      <description>I tried using the script you told me however I keep getting an error.  The error is:&lt;BR /&gt; &lt;BR /&gt;"while: Expression Syntax".  &lt;BR /&gt;&lt;BR /&gt;The code I am using is:&lt;BR /&gt;&lt;BR /&gt;#!/bin/csh&lt;BR /&gt;while read -r newset&lt;BR /&gt;do&lt;BR /&gt;rm -f $newset&lt;BR /&gt;done &amp;lt; filelist&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;What am I doing wrong?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Nov 2004 18:07:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421617#M71268</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-14T18:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421618#M71269</link>
      <description>Steven's example was a bash/sh/ksh example, not a csh example.  the language is different.&lt;BR /&gt;&lt;BR /&gt;Change the #!/bin/csh to just #!/bin/sh</description>
      <pubDate>Sun, 14 Nov 2004 18:47:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421618#M71269</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2004-11-14T18:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421619#M71270</link>
      <description>That worked just great.&lt;BR /&gt;&lt;BR /&gt;I have another question.  From my new list of files I want to select 1000 random files.  &lt;BR /&gt;How would I select the 1000 random files and delete them from the current folder and put them in another folder?</description>
      <pubDate>Sun, 14 Nov 2004 19:45:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421619#M71270</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-14T19:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421620#M71271</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;what do mean by random?&lt;BR /&gt;You can select with CTRL+mouseclick and number of files in your excel sheet, create the filelist and use mv instead of rm in the script.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Nov 2004 08:15:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421620#M71271</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-11-15T08:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421621#M71272</link>
      <description>I wanted to know if there is a way to select the files at random by having the computer select the files.  I have 1000 files I need to select.</description>
      <pubDate>Mon, 15 Nov 2004 09:13:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421621#M71272</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-15T09:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421622#M71273</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;from what source and according to what criteria is the computer to select the files?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Nov 2004 09:26:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421622#M71273</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-11-15T09:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421623#M71274</link>
      <description>The files are stored in a folder on my hard drive.  I just need to select the 1000 files with no duplicates.  No other criteria.</description>
      <pubDate>Mon, 15 Nov 2004 09:48:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421623#M71274</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-15T09:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421624#M71275</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you look for something like:&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;cd /tmp&lt;BR /&gt;for FILE in `ls | head -1000`&lt;BR /&gt;do&lt;BR /&gt;  mv ${FILE} /pathto&lt;BR /&gt;done&lt;BR /&gt;?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Nov 2004 12:13:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421624#M71275</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-11-15T12:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421625#M71276</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;The program is not selecting 1000 random files. It is selecting the files in order.  I am not sure why that is happening.  I have over 3000 files and I need to select 1000 random files out of the 3000.  Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 17 Nov 2004 23:26:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421625#M71276</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-17T23:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421626#M71277</link>
      <description>I've attached a quick perl script.&lt;BR /&gt;&lt;BR /&gt;$ random.pl &lt;DIRECTORY&gt; &lt;NUMBER_OF_RANDOM_ENTRIES&gt;&lt;BR /&gt;&lt;BR /&gt;should return &lt;NUMBER_OF_RANDOM_ENTRIES&gt; files in random order from directory &lt;DIRECTORY&gt;.&lt;/DIRECTORY&gt;&lt;/NUMBER_OF_RANDOM_ENTRIES&gt;&lt;/NUMBER_OF_RANDOM_ENTRIES&gt;&lt;/DIRECTORY&gt;</description>
      <pubDate>Wed, 17 Nov 2004 23:57:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421626#M71277</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-11-17T23:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421627#M71278</link>
      <description>I tried using the script but I have a couple of questions.  Here is your script with the information you told me to enter.   I have a test folder set up with a total of 50 files for testing.  I want to extract 20 random files from the 50 and mv them to another folder.&lt;BR /&gt;&lt;BR /&gt;Did I enter the information correctly?  &lt;BR /&gt;&lt;BR /&gt;Can the files be moved from one folder to another?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;if (scalar(@ARGV) != 2) {&lt;BR /&gt;        die "usage: $0 ~/documents/erule/test/test2 20\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;@files = &amp;lt;$ARGV[0]/*&amp;gt;;&lt;BR /&gt;fisher_yates_shuffle(\@files);&lt;BR /&gt;$, = "\n";&lt;BR /&gt;print splice(@files, 0, $ARGV[1]);&lt;BR /&gt;print "\n";&lt;BR /&gt;&lt;BR /&gt;sub fisher_yates_shuffle {&lt;BR /&gt;       my $deck = shift;  # $deck is a reference to an array&lt;BR /&gt;       my $i = @$deck;&lt;BR /&gt;       while ($i--) {&lt;BR /&gt;           my $j = int rand ($i+1);&lt;BR /&gt;           @$deck[$i,$j] = @$deck[$j,$i];&lt;BR /&gt;       }&lt;BR /&gt;}</description>
      <pubDate>Thu, 18 Nov 2004 00:34:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421627#M71278</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-18T00:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421628#M71279</link>
      <description>The script will return the names of 20 random files. If you want to move them to a different directory do the following&lt;BR /&gt;&lt;BR /&gt;$ ./random.pl ~/documents/erule/test/test2 20 | while read file&lt;BR /&gt;do&lt;BR /&gt;echo mv $i &lt;ANOTHER_DIRECTORY&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;If printout is ok remove 'echo' from the last second line (before mv).&lt;/ANOTHER_DIRECTORY&gt;</description>
      <pubDate>Thu, 18 Nov 2004 00:46:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421628#M71279</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-11-18T00:46:06Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421629#M71280</link>
      <description>Oops, 'mv $i' should be 'mv $file'&lt;BR /&gt;&lt;BR /&gt;$ ./random.pl ~/documents/erule/test/test2 20 | while read file&lt;BR /&gt;do&lt;BR /&gt;echo mv $file &lt;ANOTHER_DIRECTORY&gt;&lt;BR /&gt;done&lt;/ANOTHER_DIRECTORY&gt;</description>
      <pubDate>Thu, 18 Nov 2004 02:54:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421629#M71280</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-11-18T02:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421630#M71281</link>
      <description>The first problem I am having is that the first script does not return any file names.  I only get a line saying 'usage: randomfl.pl ~/documents/erule/test 20'.  How will this code return my file names?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;if (scalar(@ARGV) != 2) {&lt;BR /&gt;        die "usage: $0 ~/documents/erule/test 20\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;@files = &amp;lt;$ARGV[0]/*&amp;gt;;&lt;BR /&gt;fisher_yates_shuffle(\@files);&lt;BR /&gt;$, = "\n";&lt;BR /&gt;print splice(@files, 0, $ARGV[1]);&lt;BR /&gt;print "\n";&lt;BR /&gt;&lt;BR /&gt;sub fisher_yates_shuffle {&lt;BR /&gt;       my $deck = shift;  # $deck is a reference to an array&lt;BR /&gt;       my $i = @$deck;&lt;BR /&gt;       while ($i--) {&lt;BR /&gt;           my $j = int rand ($i+1);&lt;BR /&gt;           @$deck[$i,$j] = @$deck[$j,$i];&lt;BR /&gt;       }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;My second problem is with the second script you told me to use.  It is giving me errors.  I am sure I am doing something wrong.  Here is the script I used for that.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;$ ./randomfl.pl ~/documents/erule/test 20 | while read file&lt;BR /&gt;do&lt;BR /&gt;echo mv $file ~/documents/erule/test/test2&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;What mistake am I making?</description>
      <pubDate>Thu, 18 Nov 2004 11:12:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421630#M71281</guid>
      <dc:creator>Shaf_1</dc:creator>
      <dc:date>2004-11-18T11:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421631#M71282</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the second script is actually a shell script and the $ was the prompt from the shell. Replace /usr/bin/perl with /usr/bin/sh&lt;BR /&gt;That should make it work.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Nov 2004 13:17:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421631#M71282</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2004-11-18T13:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: perl help/excel/delete</title>
      <link>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421632#M71283</link>
      <description>You don't need to make any modifications to the script. On the command line type&lt;BR /&gt;&lt;BR /&gt;./randomfl.pl ~/documents/erule/test 20&lt;BR /&gt;&lt;BR /&gt;That should return list of 20 randomly selected files.&lt;BR /&gt;&lt;BR /&gt;I assume that you are running this on Linux.</description>
      <pubDate>Thu, 18 Nov 2004 18:04:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/perl-help-excel-delete/m-p/3421632#M71283</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2004-11-18T18:04:00Z</dc:date>
    </item>
  </channel>
</rss>

