<?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 scripting - running through a list in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026505#M97428</link>
    <description>Hi.&lt;BR /&gt;HPux 11.11 v1.&lt;BR /&gt;This is going to be really basic,but for some reason I am just not able to get it.!&lt;BR /&gt;I have a file of names (first and second name per line).&lt;BR /&gt;I want to take each line and run a command on it...&lt;BR /&gt;&lt;BR /&gt;file1 = &lt;BR /&gt;firstname1 lastname1&lt;BR /&gt;firstname2 lastname2&lt;BR /&gt;&lt;BR /&gt;I want to do something like:&lt;BR /&gt;&lt;BR /&gt;for i in `cat file1`&lt;BR /&gt;do &lt;BR /&gt;echo $i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and $i would echo back  with &lt;BR /&gt;firstname1 lastname1&lt;BR /&gt;&lt;BR /&gt;firstname2 lastname2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;at the moment I am getting a list like:&lt;BR /&gt;firstname1&lt;BR /&gt;lastname1&lt;BR /&gt;firstname2&lt;BR /&gt;lastname2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I know this ridiculously easy.... please someone help&lt;BR /&gt;thanks Maria</description>
    <pubDate>Sun, 04 Feb 2007 21:07:06 GMT</pubDate>
    <dc:creator>Peter Gillis</dc:creator>
    <dc:date>2007-02-04T21:07:06Z</dc:date>
    <item>
      <title>scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026505#M97428</link>
      <description>Hi.&lt;BR /&gt;HPux 11.11 v1.&lt;BR /&gt;This is going to be really basic,but for some reason I am just not able to get it.!&lt;BR /&gt;I have a file of names (first and second name per line).&lt;BR /&gt;I want to take each line and run a command on it...&lt;BR /&gt;&lt;BR /&gt;file1 = &lt;BR /&gt;firstname1 lastname1&lt;BR /&gt;firstname2 lastname2&lt;BR /&gt;&lt;BR /&gt;I want to do something like:&lt;BR /&gt;&lt;BR /&gt;for i in `cat file1`&lt;BR /&gt;do &lt;BR /&gt;echo $i&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and $i would echo back  with &lt;BR /&gt;firstname1 lastname1&lt;BR /&gt;&lt;BR /&gt;firstname2 lastname2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;at the moment I am getting a list like:&lt;BR /&gt;firstname1&lt;BR /&gt;lastname1&lt;BR /&gt;firstname2&lt;BR /&gt;lastname2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I know this ridiculously easy.... please someone help&lt;BR /&gt;thanks Maria</description>
      <pubDate>Sun, 04 Feb 2007 21:07:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026505#M97428</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2007-02-04T21:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026506#M97429</link>
      <description>&lt;!--!*#--&gt;while read fname lname&lt;BR /&gt;do&lt;BR /&gt;echo $fname lname \\n&lt;BR /&gt;done &amp;lt; file1&lt;BR /&gt;&lt;BR /&gt;hope this helps,&lt;BR /&gt;-denver</description>
      <pubDate>Sun, 04 Feb 2007 22:27:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026506#M97429</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-02-04T22:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026507#M97430</link>
      <description>sorry, I'm sure you'll catch this but I had a type-o.  lname above should read $lname  :)</description>
      <pubDate>Sun, 04 Feb 2007 22:30:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026507#M97430</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2007-02-04T22:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026508#M97431</link>
      <description>cat file1 | while read NAME&lt;BR /&gt;  do&lt;BR /&gt;     echo "Name: ${NAME}"&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;If you want firstname and lastname as separate variables then:&lt;BR /&gt;&lt;BR /&gt;cat file1 | while read FNAME LNAME&lt;BR /&gt;  do&lt;BR /&gt;     echo "First Name: ${FNAME} Last name: ${LNAME}"&lt;BR /&gt;  done&lt;BR /&gt;</description>
      <pubDate>Sun, 04 Feb 2007 22:30:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026508#M97431</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-02-04T22:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026509#M97432</link>
      <description>Clay would you please send me a reply so I can assign your points correctly?  I stuffed up again.&lt;BR /&gt;Thankyou both Denver and yourself, both methods worked for me.&lt;BR /&gt;Maria</description>
      <pubDate>Sun, 04 Feb 2007 22:49:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026509#M97432</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2007-02-04T22:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026510#M97433</link>
      <description>Actually Denver's is the better construct as it does not need to spawn a separate process though I have learned over the years that for some strange reason the cat file | while read construct is more readily grasped/grokked/understood in examples.</description>
      <pubDate>Mon, 05 Feb 2007 21:20:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026510#M97433</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-02-05T21:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026511#M97434</link>
      <description>I would say a huge thankyou to both of you. both examples were easy for me to understand and gave the required outcome.  This medium is a great way to get exposure to different methods of achieving the same result. thanks again&lt;BR /&gt;Maria</description>
      <pubDate>Mon, 05 Feb 2007 21:34:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026511#M97434</guid>
      <dc:creator>Peter Gillis</dc:creator>
      <dc:date>2007-02-05T21:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026512#M97435</link>
      <description>If you want something only a little harder to understand you can use xargs:&lt;BR /&gt;xargs -n2 echo &amp;lt; file1&lt;BR /&gt;&lt;BR /&gt;-n2 says to put only 2 arguments on the echo command.  If you wanted to have more text with the echo, you would have to execute a command.</description>
      <pubDate>Mon, 05 Feb 2007 22:51:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026512#M97435</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-02-05T22:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: scripting - running through a list</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026513#M97436</link>
      <description>&lt;!--!*#--&gt;This also works:&lt;BR /&gt;&lt;BR /&gt;cat file | while read line ; do&lt;BR /&gt;    echo $line&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Eric</description>
      <pubDate>Tue, 06 Feb 2007 04:47:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-running-through-a-list/m-p/5026513#M97436</guid>
      <dc:creator>Eric Raeburn</dc:creator>
      <dc:date>2007-02-06T04:47:48Z</dc:date>
    </item>
  </channel>
</rss>

