<?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: Incrementing two lists for variables at the same time. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144531#M93417</link>
    <description>Patrick W.,&lt;BR /&gt;&lt;BR /&gt;When I do this:&lt;BR /&gt;&lt;BR /&gt;while read OLDUID NEWUID&lt;BR /&gt;do&lt;BR /&gt;echo $OLDUID $NEWUID&lt;BR /&gt;done &amp;lt; users.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I get this:&lt;BR /&gt;&lt;BR /&gt;user1-1 user2-1&lt;BR /&gt;user1-2 user2-2&lt;BR /&gt;user1-3 user2-3&lt;BR /&gt;user1-4 user2-4&lt;BR /&gt;user1-5 user2-5&lt;BR /&gt;user1-6 user2-6&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It is working!  Now to modify it to my needs!!  Thx all!</description>
    <pubDate>Wed, 13 Feb 2008 18:10:50 GMT</pubDate>
    <dc:creator>Patrick Ware_1</dc:creator>
    <dc:date>2008-02-13T18:10:50Z</dc:date>
    <item>
      <title>Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144524#M93410</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I need help with finding a solution to an ongoing challenge for me.  I need to find a way to increment lists for variables at the same time.  Here is an example of my current challenge:&lt;BR /&gt;&lt;BR /&gt;I need to change a whole slew of users accounts to a new login ID.&lt;BR /&gt;I have two lists.  One list has the current user ID's, and the other list has the new user ID's.  How can I script this, so that both lists are read in order, and in sync?  In other words, I want the first line of the first list to correspond with the 1st line of the 2nd list, and so on.  How would I do this?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Feb 2008 16:42:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144524#M93410</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2008-02-13T16:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144525#M93411</link>
      <description>Hey&lt;BR /&gt;&lt;BR /&gt;please post the format of the files.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 13 Feb 2008 16:48:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144525#M93411</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2008-02-13T16:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144526#M93412</link>
      <description>If the files you want are currently sorted in the order you want, why not use 'paste' to combine the 2 files into a single file?&lt;BR /&gt;&lt;BR /&gt;# paste file1 file2 &amp;gt; file3&lt;BR /&gt;&lt;BR /&gt;Then when you script your user modification routine do something like:&lt;BR /&gt;&lt;BR /&gt;while read OLDUID NEWUID&lt;BR /&gt;do&lt;BR /&gt;...do stuff here...&lt;BR /&gt;done &amp;lt; file3&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Feb 2008 16:55:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144526#M93412</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2008-02-13T16:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144527#M93413</link>
      <description>Both files have the following format:&lt;BR /&gt;&lt;BR /&gt;user1&lt;BR /&gt;user2&lt;BR /&gt;user3&lt;BR /&gt;user4&lt;BR /&gt;user5&lt;BR /&gt;user6&lt;BR /&gt;user7&lt;BR /&gt;user8&lt;BR /&gt;user9&lt;BR /&gt;user10&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;...and so on...</description>
      <pubDate>Wed, 13 Feb 2008 17:00:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144527#M93413</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2008-02-13T17:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144528#M93414</link>
      <description>Patrick paste is the perfect solution for what you need.&lt;BR /&gt;file1:&lt;BR /&gt;01&lt;BR /&gt;02&lt;BR /&gt;03&lt;BR /&gt;04&lt;BR /&gt;05&lt;BR /&gt;file2:&lt;BR /&gt;06&lt;BR /&gt;07&lt;BR /&gt;08&lt;BR /&gt;09&lt;BR /&gt;010&lt;BR /&gt;&lt;BR /&gt;paste file1 file2 &amp;gt;file3&lt;BR /&gt;&lt;BR /&gt;file3&lt;BR /&gt;01 06&lt;BR /&gt;02 07&lt;BR /&gt;03 08&lt;BR /&gt;04 09&lt;BR /&gt;05 010&lt;BR /&gt;hope this helps</description>
      <pubDate>Wed, 13 Feb 2008 17:12:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144528#M93414</guid>
      <dc:creator>David Bellamy</dc:creator>
      <dc:date>2008-02-13T17:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144529#M93415</link>
      <description>I think I understand now.  Let me give this a try, and I'll let you all know how I make out.  If you have other ways, don't hesitate to post them also.  Thanks to all!</description>
      <pubDate>Wed, 13 Feb 2008 17:17:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144529#M93415</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2008-02-13T17:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144530#M93416</link>
      <description>Ok, so is it possible to just pull from two lists the way I originally specified?</description>
      <pubDate>Wed, 13 Feb 2008 17:58:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144530#M93416</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2008-02-13T17:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144531#M93417</link>
      <description>Patrick W.,&lt;BR /&gt;&lt;BR /&gt;When I do this:&lt;BR /&gt;&lt;BR /&gt;while read OLDUID NEWUID&lt;BR /&gt;do&lt;BR /&gt;echo $OLDUID $NEWUID&lt;BR /&gt;done &amp;lt; users.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I get this:&lt;BR /&gt;&lt;BR /&gt;user1-1 user2-1&lt;BR /&gt;user1-2 user2-2&lt;BR /&gt;user1-3 user2-3&lt;BR /&gt;user1-4 user2-4&lt;BR /&gt;user1-5 user2-5&lt;BR /&gt;user1-6 user2-6&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It is working!  Now to modify it to my needs!!  Thx all!</description>
      <pubDate>Wed, 13 Feb 2008 18:10:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144531#M93417</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2008-02-13T18:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Incrementing two lists for variables at the same time.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144532#M93418</link>
      <description>&lt;!--!*#--&gt;A shell-only solution can be constructed&lt;BR /&gt;using more exotic I/O redirection, providing&lt;BR /&gt;a look (open, read, ...) closer to that of a&lt;BR /&gt;regular programming language (like DCL, for&lt;BR /&gt;example):&lt;BR /&gt;&lt;BR /&gt;dy # cat ./nm.dat&lt;BR /&gt;aaa&lt;BR /&gt;bbb&lt;BR /&gt;ccc&lt;BR /&gt;dy # cat ./nr.dat&lt;BR /&gt;111&lt;BR /&gt;222&lt;BR /&gt;333&lt;BR /&gt;dy # cat ./rdr.sh&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;exec 3&amp;lt;./nm.dat&lt;BR /&gt;exec 4&amp;lt;./nr.dat&lt;BR /&gt;&lt;BR /&gt;while read nm &amp;lt;&amp;amp;3 ; do&lt;BR /&gt;    read nr &amp;lt;&amp;amp;4&lt;BR /&gt;    echo "nm: &amp;gt;${nm}&amp;lt;, nr: &amp;gt;${nr}&amp;lt;."&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;dy # ./rdr.sh&lt;BR /&gt;nm: &amp;gt;aaa&amp;lt;, nr: &amp;gt;111&amp;lt;.&lt;BR /&gt;nm: &amp;gt;bbb&amp;lt;, nr: &amp;gt;222&amp;lt;.&lt;BR /&gt;nm: &amp;gt;ccc&amp;lt;, nr: &amp;gt;333&amp;lt;.&lt;BR /&gt;&lt;BR /&gt;It's also possible to add some error handling&lt;BR /&gt;to cope with file pairs with different line&lt;BR /&gt;counts, and it may be easier to do this well&lt;BR /&gt;if you keep the files' data separate.  (After&lt;BR /&gt;"paste" smooshes them together, it may not be&lt;BR /&gt;obvious which one has the problem.)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Reverse the "&amp;lt;" characters, and it's possible&lt;BR /&gt;to write to more than one file at a time&lt;BR /&gt;(more than only stdout), too, just as this&lt;BR /&gt;script shows how to read from more than one&lt;BR /&gt;file at a time (more than only stdin).</description>
      <pubDate>Wed, 13 Feb 2008 22:30:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/incrementing-two-lists-for-variables-at-the-same-time/m-p/4144532#M93418</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-02-13T22:30:05Z</dc:date>
    </item>
  </channel>
</rss>

