<?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: Parising the list of the files to be deleted in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698631#M248922</link>
    <description>Hi Shiv,&lt;BR /&gt;&lt;BR /&gt;it would be nice that you you to get such &lt;BR /&gt;a kind of document "SHELLS:User guide"&lt;BR /&gt;&lt;BR /&gt;Good Luck,</description>
    <pubDate>Wed, 28 Dec 2005 01:25:14 GMT</pubDate>
    <dc:creator>Cem Tugrul</dc:creator>
    <dc:date>2005-12-28T01:25:14Z</dc:date>
    <item>
      <title>Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698623#M248914</link>
      <description>Dear Sirs,&lt;BR /&gt;&lt;BR /&gt;I want to clean up certain files in some log directory. I went to the log directory for listings of the files to be deleted.&lt;BR /&gt;I selected the files to be deleted. I redirected the output of $ll -lrt &amp;gt; tempfile. I edited this tempfile for the files to be deleted. Now this tempfile the contains the list of the files to be deleted.&lt;BR /&gt;&lt;BR /&gt;I want to parse this tempfile to delete the files. Can anyone suggest the complete syntax of the command to be used rm command ? &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv</description>
      <pubDate>Tue, 27 Dec 2005 15:58:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698623#M248914</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2005-12-27T15:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698624#M248915</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Say the file "file_name" has entries&lt;BR /&gt;&lt;BR /&gt;file1&lt;BR /&gt;file2&lt;BR /&gt;.....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you can try,&lt;BR /&gt;&lt;BR /&gt;# cat file_name |while read FILE&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; rm $FILE&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Dec 2005 16:03:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698624#M248915</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2005-12-27T16:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698625#M248916</link>
      <description>Can I use -i option also to confirm before deleting the files ?</description>
      <pubDate>Tue, 27 Dec 2005 17:00:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698625#M248916</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2005-12-27T17:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698626#M248917</link>
      <description>Hi Shiv,&lt;BR /&gt;&lt;BR /&gt;You can dress it up any way you like it. This was pretty raw. you can use the -i option with the rm command.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Dec 2005 17:04:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698626#M248917</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2005-12-27T17:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698627#M248918</link>
      <description>Hi Shiv:&lt;BR /&gt;&lt;BR /&gt;If you simply add 'rm -i' to the read loop as for example:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read LINE&lt;BR /&gt;do&lt;BR /&gt;  rm -i ${LINE}&lt;BR /&gt;done &amp;lt; /tmp/files_to_remove&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;...then you are mixing input from STDIN and you will *not* accomplish what you want.&lt;BR /&gt;&lt;BR /&gt;Instead you need to separate (with different file descriptors) the input from the interactive 'rm' and the input from the file that you are reading:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;exec 3&amp;lt; /tmp/files_to_remove&lt;BR /&gt;while read -u3 LINE&lt;BR /&gt;do&lt;BR /&gt;  rm -i ${LINE}&lt;BR /&gt;done&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;The second script will work.  File descriptor #3 is used to read lines from the file '/tmp/files_to_remove'.  Each LINE (file name) so read is offered for an interactive remove.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 27 Dec 2005 17:24:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698627#M248918</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-27T17:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698628#M248919</link>
      <description>Respected James Sir,&lt;BR /&gt;&lt;BR /&gt;If "files_to_remove" contains the list of the files to be removed then what is the purpose of word "LINE" in the script ?&lt;BR /&gt;&lt;BR /&gt;Kindly explain.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Dec 2005 18:30:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698628#M248919</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2005-12-27T18:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698629#M248920</link>
      <description>Hi Shiv:&lt;BR /&gt;&lt;BR /&gt;You asked "If 'files_to_remove' contains the list of the files to be removed then what is the purpose of word 'LINE' in the script?"&lt;BR /&gt;&lt;BR /&gt;Yes, I used the name 'files_to_remove' to represent the name of the file that contains a list of files to remove.  For example:&lt;BR /&gt;&lt;BR /&gt;# cat files_to_remove&lt;BR /&gt;/tmp/f1&lt;BR /&gt;/tmp/f2&lt;BR /&gt;/tmp/f3&lt;BR /&gt;/home/jrf/oldtuff&lt;BR /&gt;/home/shiv/oldstuff&lt;BR /&gt;&lt;BR /&gt;The word 'LINE' was merely the name that I chose for a variable that holds the data from a 'read' operation.  In this case, the 'read' fills the 'LINE' variable with whatever it reads up until a newline character.&lt;BR /&gt;&lt;BR /&gt;Since I only expected one field on each "line" of the file, I only used one variable.&lt;BR /&gt;&lt;BR /&gt;Have a look at the man pages for 'read(1)' and compare how these two scripts work by running them and typing various sentences.  Use a CTRL_D to kill each script:&lt;BR /&gt;&lt;BR /&gt;while read X &lt;BR /&gt;do&lt;BR /&gt;  echo ${X}&lt;BR /&gt;done &amp;lt; /dev/tty&lt;BR /&gt;&lt;BR /&gt;...versus:&lt;BR /&gt;&lt;BR /&gt;while read X Y Z&lt;BR /&gt;do&lt;BR /&gt;  echo ${X}&lt;BR /&gt;done &amp;lt; dev/tty&lt;BR /&gt;&lt;BR /&gt;For example type sentences like:&lt;BR /&gt;&lt;BR /&gt;who am i&lt;BR /&gt;what&lt;BR /&gt;does this help you understand?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 27 Dec 2005 18:48:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698629#M248920</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-27T18:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698630#M248921</link>
      <description>Hi Shiv, LINE is a shell variable which is used in reading values passed to that script. If you want to know more about it, &lt;A href="http://www.shelldorado.com/goodcoding/cmdargs.html" target="_blank"&gt;http://www.shelldorado.com/goodcoding/cmdargs.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Tue, 27 Dec 2005 22:41:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698630#M248921</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-12-27T22:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698631#M248922</link>
      <description>Hi Shiv,&lt;BR /&gt;&lt;BR /&gt;it would be nice that you you to get such &lt;BR /&gt;a kind of document "SHELLS:User guide"&lt;BR /&gt;&lt;BR /&gt;Good Luck,</description>
      <pubDate>Wed, 28 Dec 2005 01:25:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698631#M248922</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-28T01:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698632#M248923</link>
      <description>Hi Shiv,&lt;BR /&gt;with simple command in one line:&lt;BR /&gt;rm -i $(&lt;FILES_TO_REMOVE&gt;&lt;/FILES_TO_REMOVE&gt;&lt;BR /&gt;1. $() executes teh command within the parenthesis&lt;BR /&gt;2. &amp;lt; reads the files_to_removes&lt;BR /&gt;3. rm -i remove the file asking if ok&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Wed, 28 Dec 2005 03:33:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698632#M248923</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2005-12-28T03:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698633#M248924</link>
      <description>Hi Shiv ,&lt;BR /&gt;&lt;BR /&gt;Here is another , you can use:&lt;BR /&gt;&lt;BR /&gt;Example: the file name is : files_to_remove&lt;BR /&gt;&lt;BR /&gt;# vi remove.sh&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;######## Removing files from the list file: files_to_remove ########################&lt;BR /&gt;&lt;BR /&gt;for i in `cat files_to_remove`&lt;BR /&gt;do&lt;BR /&gt;rm -i $i&lt;BR /&gt;echo "FILE: $i will be removed now"&lt;BR /&gt;done&lt;BR /&gt;echo "File Remove completed"&lt;BR /&gt;##########################################&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;To execute this :&lt;BR /&gt;# chmod +x remove.sh&lt;BR /&gt;# ./remove.sh&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raj.</description>
      <pubDate>Wed, 28 Dec 2005 03:41:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698633#M248924</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2005-12-28T03:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698634#M248925</link>
      <description>Why you are redirecting to some file and then doing action. Try as,&lt;BR /&gt;&lt;BR /&gt;# cd &lt;DIRECTORY&gt;&lt;BR /&gt;# ls -lrt | awk '/^-/ { print $9; }' | xargs rm -f&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;/DIRECTORY&gt;</description>
      <pubDate>Wed, 28 Dec 2005 03:44:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698634#M248925</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-28T03:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698635#M248926</link>
      <description>More informations,&lt;BR /&gt;&lt;BR /&gt;ll -lrt &amp;gt; tempfile is a main problem.&lt;BR /&gt;&lt;BR /&gt;It will give directory, filenames etc to the tempfile. If you try to remove with rm command then it will delete files and as well as directories when proceeding with option -rf.&lt;BR /&gt;&lt;BR /&gt;You can get only files in that directory not the sub directory then,&lt;BR /&gt;&lt;BR /&gt;# cd &lt;DIRECTORY&gt;&lt;BR /&gt;# ls -lrt | awk '/^-/ { print $9; }' | xargs rm -f&lt;BR /&gt;&lt;BR /&gt;^- will give only files. $9 is the file name.&lt;BR /&gt;xargs used to get all files and do the rm -f action.&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;BR /&gt;&lt;/DIRECTORY&gt;</description>
      <pubDate>Wed, 28 Dec 2005 03:47:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698635#M248926</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-28T03:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698636#M248927</link>
      <description>If you want interactive deletion, you can use -i option with "rm". Better create an alias for Trash and delete your files. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Wed, 28 Dec 2005 03:53:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698636#M248927</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2005-12-28T03:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Parising the list of the files to be deleted</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698637#M248928</link>
      <description>Hi Shiv,&lt;BR /&gt;&lt;BR /&gt;You must use awk , to filter only the file names in your files_to_remove  file list.&lt;BR /&gt;And so that it will only contains the names of the file not the permissions and date time stamp.&lt;BR /&gt;&lt;BR /&gt;ex:&lt;BR /&gt;# ls -l |grep -v ^d |  awk '{print $9}' &amp;gt; files_to_remove&lt;BR /&gt;&lt;BR /&gt;[ It will eliminate the directory names and only files will be listed in the file ]&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Raj.&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Dec 2005 04:01:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/parising-the-list-of-the-files-to-be-deleted/m-p/3698637#M248928</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2005-12-28T04:01:32Z</dc:date>
    </item>
  </channel>
</rss>

