<?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-wizards? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583628#M924723</link>
    <description>It worked! You really made my day there...Thnxs a lot!....=)&lt;BR /&gt;&lt;BR /&gt;"Every problem is easy as long as you know the answer!</description>
    <pubDate>Mon, 24 Sep 2001 08:29:36 GMT</pubDate>
    <dc:creator>Petter Selin</dc:creator>
    <dc:date>2001-09-24T08:29:36Z</dc:date>
    <item>
      <title>Script-wizards?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583626#M924721</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;I really dunno if this is the right forum to have this thread...but i`ll just post it and hope that there are some programming-wizards out there.&lt;BR /&gt;&lt;BR /&gt;Problem:&lt;BR /&gt;I need to write a script that compares files in a dir. and the 2 files with similar extension should..&lt;BR /&gt;1) Write the first files content &lt;BR /&gt;2) ...into a file named after the second file`s content.&lt;BR /&gt;&lt;BR /&gt;hehe..r u with me?&lt;BR /&gt;&lt;BR /&gt;Oki...lets start with the dir..It looks like this...(but it is in the tmp dir and will change all the time)&lt;BR /&gt;&lt;BR /&gt;/tmp&lt;BR /&gt;ldapsearch-cartype-008680  ldapsearch-cartype-f08680  ldapsearch-cartype-l08680&lt;BR /&gt;ldapsearch-Descriptiontype-008680&lt;BR /&gt;&lt;BR /&gt;Here you see that the first line and the last looks the same if you look at the last part. (008680)...Now we just say that "echo ldapsearch-carname-008680 = Volvo" and "echo ldapsearch-Description-008680 = Blue".....Then I want the script 2 create a file namned "Volvo" with "Blue" in it. Comprende?..:)&lt;BR /&gt;&lt;BR /&gt;Now when we come to the programming, and i'm really a newbie at that, i have written something like this..(which of course is`nt even close 2 work..=(...)&lt;BR /&gt;&lt;BR /&gt;Solotion:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;DIR=/opt/ldap/tmp/*Description*&lt;BR /&gt;FILES=`ls -1 /opt/ldap/tmp/*cartype*`&lt;BR /&gt;OUTFILE=/opt/ldap/ldapCOMP&lt;BR /&gt;&lt;BR /&gt;rm -f ${OUTFILE}&lt;BR /&gt;&lt;BR /&gt;for F in $FILES;&lt;BR /&gt;&lt;BR /&gt;do if [ $FILES &amp;amp;&amp;amp; $Dir =~ "`type-*`" ]&lt;BR /&gt;&lt;BR /&gt; then `cat ${FILES}` &amp;gt;&amp;gt; Symbols/`cat ${Dir}`&lt;BR /&gt; else :&lt;BR /&gt; fi&lt;BR /&gt;  &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hm...I don't expect anyone 2 waste their time on this...But...Se it as a challenge then...;)&lt;BR /&gt;&lt;BR /&gt;best regards&lt;BR /&gt;Petter</description>
      <pubDate>Mon, 24 Sep 2001 06:45:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583626#M924721</guid>
      <dc:creator>Petter Selin</dc:creator>
      <dc:date>2001-09-24T06:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script-wizards?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583627#M924722</link>
      <description>Hi Petter,&lt;BR /&gt;&lt;BR /&gt;Something like:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;cd /tmp/forum&lt;BR /&gt;for file in ldapsearch-cartype-[0-9]* ; do&lt;BR /&gt; suffix=${file#ldapsearch-cartype-}&lt;BR /&gt; desc=ldapsearch-Description-$suffix&lt;BR /&gt; cat $desc &amp;gt; `cat $file`&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I'm assuming the suffix always starts with a number.  Loads of other ways, just the 1st one that came to mind.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Mon, 24 Sep 2001 07:01:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583627#M924722</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-09-24T07:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: Script-wizards?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583628#M924723</link>
      <description>It worked! You really made my day there...Thnxs a lot!....=)&lt;BR /&gt;&lt;BR /&gt;"Every problem is easy as long as you know the answer!</description>
      <pubDate>Mon, 24 Sep 2001 08:29:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583628#M924723</guid>
      <dc:creator>Petter Selin</dc:creator>
      <dc:date>2001-09-24T08:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script-wizards?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583629#M924724</link>
      <description>if you want to user the web browser&lt;BR /&gt;script called diff_upload.cgi&lt;BR /&gt;&lt;BR /&gt;*****************************************&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;$DIFF = "/usr/bin/diff";&lt;BR /&gt;$PERL = "/usr/bin/perl";&lt;BR /&gt;&lt;BR /&gt;use CGI qw(:standard);&lt;BR /&gt;use CGI::Carp;&lt;BR /&gt;&lt;BR /&gt;print header;&lt;BR /&gt;print start_html("File Diff Example");&lt;BR /&gt;print "&lt;STRONG&gt;Version &lt;/STRONG&gt;$CGI::VERSION&lt;P&gt;";&lt;BR /&gt;&lt;BR /&gt;print &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;/P&gt;&lt;H1&gt;File Diff Example&lt;/H1&gt;&lt;BR /&gt;Enter two files.  When you press "submit" their diff will be&lt;BR /&gt;produced.&lt;BR /&gt;EOF&lt;BR /&gt;    ;&lt;BR /&gt;&lt;BR /&gt;# Start a multipart form.&lt;BR /&gt;print start_multipart_form;&lt;BR /&gt;print "File #1:",filefield(-name=&amp;gt;'file1',-size=&amp;gt;45),"&lt;BR /&gt;\n";&lt;BR /&gt;print "File #2:",filefield(-name=&amp;gt;'file2',-size=&amp;gt;45),"&lt;BR /&gt;\n";&lt;BR /&gt;print "Diff type: ",radio_group(-name=&amp;gt;'type',&lt;BR /&gt;     -value=&amp;gt;['context','normal']),"&lt;BR /&gt;\n";&lt;BR /&gt;print reset,submit(-name=&amp;gt;'submit',-value=&amp;gt;'Do Diff');&lt;BR /&gt;print endform;&lt;BR /&gt;&lt;BR /&gt;# Process the form if there is a file name entered&lt;BR /&gt;$file1 = param('file1');&lt;BR /&gt;$file2 = param('file2');&lt;BR /&gt;&lt;BR /&gt;$|=1;    # for buffering&lt;BR /&gt;if ($file1 &amp;amp;&amp;amp; $file2) {&lt;BR /&gt;    $realfile1 = tmpFileName($file1);&lt;BR /&gt;    $realfile2 = tmpFileName($file2);&lt;BR /&gt;    print "&lt;HR /&gt;\n";&lt;BR /&gt;    print "&lt;H2&gt;$file1 vs $file2&lt;/H2&gt;\n";&lt;BR /&gt;&lt;BR /&gt;    print "&lt;PRE&gt;\n";&lt;BR /&gt;    $options = "-c" if param('type') eq 'context';&lt;BR /&gt;    system "$DIFF $options $realfile1 $realfile2 | $PERL -pe 's/&amp;gt;/&amp;gt;/g; s/    close $file1;&lt;BR /&gt;    close $file2;&lt;BR /&gt;    print "&lt;/PRE&gt;\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;print &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;ADDRESS&gt;&lt;BR /&gt;Last modified 13 MAR 2001&lt;BR /&gt;EOF&lt;BR /&gt;    ;&lt;BR /&gt;print end_html;&lt;BR /&gt;&lt;BR /&gt;sub sanitize {&lt;BR /&gt;    my $name = shift;&lt;BR /&gt;    my($safe) = $name=~/([a-zA-Z0-9._~#,]+)/;&lt;BR /&gt;    unless ($safe) {&lt;BR /&gt; print "&lt;STRONG&gt;$name is not a valid Unix filename -- sorry&lt;/STRONG&gt;";&lt;BR /&gt; exit 0;&lt;BR /&gt;    }&lt;BR /&gt;    return $safe;&lt;BR /&gt;}&lt;BR /&gt;&lt;/ADDRESS&gt;</description>
      <pubDate>Mon, 24 Sep 2001 15:27:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-wizards/m-p/2583629#M924724</guid>
      <dc:creator>Robert Binkley</dc:creator>
      <dc:date>2001-09-24T15:27:43Z</dc:date>
    </item>
  </channel>
</rss>

