<?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: Script help needed (easy one) in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588147#M103789</link>
    <description>while read -r filename&lt;BR /&gt;do&lt;BR /&gt;   chown $filename:$filename $filename&lt;BR /&gt;done &amp;lt; filelist&lt;BR /&gt;&lt;BR /&gt;Thats a simple shell that changes ownership and group.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Thu, 21 Jul 2005 19:49:01 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2005-07-21T19:49:01Z</dc:date>
    <item>
      <title>Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588146#M103788</link>
      <description>OK...brain fart happening here....&lt;BR /&gt;I want to take a list that is in a file and execute a chown on each entry so that the owner is the same....&lt;BR /&gt;&lt;BR /&gt;OK...I didn't even understand that.  Let me lay it out like this...&lt;BR /&gt;&lt;BR /&gt;File 1 contains the following entries:&lt;BR /&gt;abc&lt;BR /&gt;def&lt;BR /&gt;&lt;BR /&gt;I want to execute a chown on each in a way like this...&lt;BR /&gt;&lt;BR /&gt;chown abc abc&lt;BR /&gt;&lt;BR /&gt;Therefore making the owner the same as the name of the file.&lt;BR /&gt;&lt;BR /&gt;However I have a very long list to do...I'm lazy....and scripting is not my strength.  Any help is appreciated.</description>
      <pubDate>Thu, 21 Jul 2005 19:37:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588146#M103788</guid>
      <dc:creator>TheJuiceman</dc:creator>
      <dc:date>2005-07-21T19:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588147#M103789</link>
      <description>while read -r filename&lt;BR /&gt;do&lt;BR /&gt;   chown $filename:$filename $filename&lt;BR /&gt;done &amp;lt; filelist&lt;BR /&gt;&lt;BR /&gt;Thats a simple shell that changes ownership and group.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Thu, 21 Jul 2005 19:49:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588147#M103789</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-07-21T19:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588148#M103790</link>
      <description>Only abc is as user rgt. You have to use as,&lt;BR /&gt;&lt;BR /&gt;while read line;&lt;BR /&gt;do&lt;BR /&gt;  chown $line $line&lt;BR /&gt;done &amp;lt; filename&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;awk '{ print "chown "$0" "$0 }' filename | sh&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Jul 2005 22:14:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588148#M103790</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-07-21T22:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588149#M103791</link>
      <description>cat filename.list | xargs -i chown {} {} &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Jul 2005 22:21:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588149#M103791</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-21T22:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588150#M103792</link>
      <description>for i in `cat filename.list'&lt;BR /&gt;do&lt;BR /&gt;chown $i $i&lt;BR /&gt;done</description>
      <pubDate>Thu, 21 Jul 2005 22:23:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588150#M103792</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-07-21T22:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588151#M103793</link>
      <description>You can do also as,&lt;BR /&gt;&lt;BR /&gt;perl -pi -e 's/^(.*)/chown \$1 \$1/' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;sh &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/FILENAME&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Thu, 21 Jul 2005 22:49:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588151#M103793</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-07-21T22:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588152#M103794</link>
      <description>Bob,&lt;BR /&gt;&lt;BR /&gt;Here is a one-line awk construct that can be used for your script:&lt;BR /&gt;&lt;BR /&gt;# awk '{system("chown "$1":"$1" "$1)}' File1&lt;BR /&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Mon, 25 Jul 2005 11:48:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588152#M103794</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-07-25T11:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588153#M103795</link>
      <description>"xargs" is very handy for this sort of thing.&lt;BR /&gt; &lt;BR /&gt;cat filename | xargs -i: chmod : :&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 25 Jul 2005 14:46:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588153#M103795</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2005-07-25T14:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed (easy one)</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588154#M103796</link>
      <description>In agreement with one of John's answers, my vote is to use xargs.  It's simple, very very fast, portable, and is designed for this purpose.&lt;BR /&gt;&lt;BR /&gt;cat filename.list | xargs -i chown {} {}&lt;BR /&gt;&lt;BR /&gt;You may need to escape the brackets {} depending on what shell you are using.&lt;BR /&gt;&lt;BR /&gt;Things to note:&lt;BR /&gt;xargs is one of those small and fast swords to keep at your side.  It can do great things at fast speeds in a very small package.&lt;BR /&gt;&lt;BR /&gt;Another example of xargs would be change permissions of files:&lt;BR /&gt;&lt;BR /&gt;cat filelist | xargs chmod 777&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Or in another example, use find to pipe directly to xargs and print the cksum of each file:&lt;BR /&gt;&lt;BR /&gt;find . -print | xargs cksum&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And of course can be used to destroy things:&lt;BR /&gt;&lt;BR /&gt;find . -print | xargs rm -f&lt;BR /&gt;&lt;BR /&gt;(hehehe, DO NOT ACTUALLY DO THAT unless you want to whack all files in a directory)&lt;BR /&gt;&lt;BR /&gt;Read the man page for xargs for more info.&lt;BR /&gt;&lt;BR /&gt;-- Tom</description>
      <pubDate>Mon, 25 Jul 2005 14:47:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help-needed-easy-one/m-p/3588154#M103796</guid>
      <dc:creator>Tom Schroll</dc:creator>
      <dc:date>2005-07-25T14:47:19Z</dc:date>
    </item>
  </channel>
</rss>

