<?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: Creating a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794130#M80522</link>
    <description>This might work, but I would test it first...&lt;BR /&gt;&lt;BR /&gt;paste file1 file2 | xargs -n2 cp -r&lt;BR /&gt;&lt;BR /&gt;If file1 is&lt;BR /&gt;aaa&lt;BR /&gt;bbb&lt;BR /&gt;&lt;BR /&gt;and file2 is&lt;BR /&gt;ccc&lt;BR /&gt;ddd&lt;BR /&gt;&lt;BR /&gt;then the result is-&lt;BR /&gt;aaa&lt;TAB&gt;ccc&lt;BR /&gt;bbb&lt;TAB&gt;ddd&lt;BR /&gt;&lt;BR /&gt;is pipe to xargs, which will then generate-&lt;BR /&gt;cp -r aaa ccc&lt;BR /&gt;cp -r bbb ddd&lt;BR /&gt;&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;/TAB&gt;&lt;/TAB&gt;</description>
    <pubDate>Mon, 26 Aug 2002 16:12:59 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2002-08-26T16:12:59Z</dc:date>
    <item>
      <title>Creating a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794127#M80519</link>
      <description>I would like some help with a script that I am attempting to write.  My goal is to move data from one location and place it in another.  I have a list of data in one file (file1) and a list of new locations in another file (file2).  The files hare identical except for the beginning part of the path in each line.  This is what I see as the end command.&lt;BR /&gt;for each item &lt;BR /&gt;cp -r (item in file1) (item in file2)&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Aug 2002 15:54:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794127#M80519</guid>
      <dc:creator>Michael Allmer</dc:creator>
      <dc:date>2002-08-26T15:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794128#M80520</link>
      <description>&lt;BR /&gt;It would be convenient to have both files merged into one, named file, such that each line has two items delimited by whitespace. The first example covers this approach:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;while read item1 item2&lt;BR /&gt;do&lt;BR /&gt;cp -pr $item1 $item2&lt;BR /&gt;done &amp;lt; file&lt;BR /&gt;&lt;BR /&gt;To use separate files of identical length and order, this should work:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;exec 3&amp;lt; file1&lt;BR /&gt;exec 4&amp;lt; file2&lt;BR /&gt;while read -u3 item1&lt;BR /&gt;do&lt;BR /&gt;if read -u4 item2&lt;BR /&gt;then&lt;BR /&gt;cp -pr $item1 $item2&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;exec 3&amp;lt;&amp;amp;-&lt;BR /&gt;exec 4&amp;lt;&amp;amp;-&lt;BR /&gt;&lt;BR /&gt;More can be done to test for the existence of the source files/directories and the ability to create the target locations.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Aug 2002 16:10:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794128#M80520</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2002-08-26T16:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794129#M80521</link>
      <description>Mike,&lt;BR /&gt;&lt;BR /&gt;assuming filenames are unique in each file :&lt;BR /&gt;you could run a script like :&lt;BR /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;for filename in `cat file1`&lt;BR /&gt;do&lt;BR /&gt;  echo $filename&lt;BR /&gt;  f1=`basename $filename`&lt;BR /&gt;  f2=`grep $f1 file2`&lt;BR /&gt;  cmd="cp $filename $f2"&lt;BR /&gt;  echo $cmd&lt;BR /&gt;done&lt;BR /&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;This also assume all the file names exist.&lt;BR /&gt;in file1 is a list of pathnames&lt;BR /&gt;in file2 is a list of target pathnames&lt;BR /&gt;&lt;BR /&gt;instead of echo $cmd use eval $cmd.&lt;BR /&gt;&lt;BR /&gt;Try it in your test environment 1st.&lt;BR /&gt;Hope this help&lt;BR /&gt;&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Mon, 26 Aug 2002 16:12:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794129#M80521</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-08-26T16:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794130#M80522</link>
      <description>This might work, but I would test it first...&lt;BR /&gt;&lt;BR /&gt;paste file1 file2 | xargs -n2 cp -r&lt;BR /&gt;&lt;BR /&gt;If file1 is&lt;BR /&gt;aaa&lt;BR /&gt;bbb&lt;BR /&gt;&lt;BR /&gt;and file2 is&lt;BR /&gt;ccc&lt;BR /&gt;ddd&lt;BR /&gt;&lt;BR /&gt;then the result is-&lt;BR /&gt;aaa&lt;TAB&gt;ccc&lt;BR /&gt;bbb&lt;TAB&gt;ddd&lt;BR /&gt;&lt;BR /&gt;is pipe to xargs, which will then generate-&lt;BR /&gt;cp -r aaa ccc&lt;BR /&gt;cp -r bbb ddd&lt;BR /&gt;&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;/TAB&gt;&lt;/TAB&gt;</description>
      <pubDate>Mon, 26 Aug 2002 16:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794130#M80522</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-08-26T16:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794131#M80523</link>
      <description>I want to thank all of you for your assistance with this issue.  I have a workable solution to my problem now.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Aug 2002 16:28:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794131#M80523</guid>
      <dc:creator>Michael Allmer</dc:creator>
      <dc:date>2002-08-26T16:28:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794132#M80524</link>
      <description>Thank you, Rodney! I knew there was a command to merge two files like that, but I couldn't think of it. Paste. Almost doesn't make sense.</description>
      <pubDate>Mon, 26 Aug 2002 16:34:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/creating-a-script/m-p/2794132#M80524</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2002-08-26T16:34:39Z</dc:date>
    </item>
  </channel>
</rss>

