<?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 insertion in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299039#M711751</link>
    <description># echo abcdefghijkl | sed "s/\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)/\1.\2.\3/"&lt;BR /&gt;abcd.efgh.ijkl&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
    <pubDate>Tue, 08 Jun 2004 08:14:07 GMT</pubDate>
    <dc:creator>harry d brown jr</dc:creator>
    <dc:date>2004-06-08T08:14:07Z</dc:date>
    <item>
      <title>script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299037#M711749</link>
      <description>Hello,&lt;BR /&gt;On HPUX ksh :&lt;BR /&gt;On a file,i want to transform string&lt;BR /&gt;xxxxxxxxxxxx&lt;BR /&gt;with ( insert .)&lt;BR /&gt;xxxx.xxxx.xxxx&lt;BR /&gt;Thanks a lot.</description>
      <pubDate>Tue, 08 Jun 2004 08:05:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299037#M711749</guid>
      <dc:creator>iranzo</dc:creator>
      <dc:date>2004-06-08T08:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299038#M711750</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;cat filename | sed -e s/xxxxxxxxxxxx/xxxx.xxxx.xxxx/g &amp;gt; newfilename&lt;BR /&gt;&lt;BR /&gt;John.</description>
      <pubDate>Tue, 08 Jun 2004 08:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299038#M711750</guid>
      <dc:creator>John Carr_2</dc:creator>
      <dc:date>2004-06-08T08:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299039#M711751</link>
      <description># echo abcdefghijkl | sed "s/\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)/\1.\2.\3/"&lt;BR /&gt;abcd.efgh.ijkl&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Tue, 08 Jun 2004 08:14:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299039#M711751</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2004-06-08T08:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299040#M711752</link>
      <description>use sed:&lt;BR /&gt;sed "s/xxxxxxxxxxxx/xxxx.xxxx.xxxx/" filename</description>
      <pubDate>Tue, 08 Jun 2004 08:14:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299040#M711752</guid>
      <dc:creator>Abdul Rahiman</dc:creator>
      <dc:date>2004-06-08T08:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299041#M711753</link>
      <description>Hi there,&lt;BR /&gt;1. open the file using vi&lt;BR /&gt;2. press : to go to command line.&lt;BR /&gt;3. enter command s/xxxxxxxxxxxx/xxxx.xxxx.xxxx/g&lt;BR /&gt;4. :wq!&lt;BR /&gt;to save and exit.&lt;BR /&gt;that's all.&lt;BR /&gt;&lt;BR /&gt;Regards,</description>
      <pubDate>Tue, 08 Jun 2004 08:19:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299041#M711753</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-06-08T08:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299042#M711754</link>
      <description>Thanks,&lt;BR /&gt;But there are lot of line&lt;BR /&gt;on my file , x is variable&lt;BR /&gt;i want to insert . every four caracters&lt;BR /&gt;here my file:&lt;BR /&gt;512df456rt89&lt;BR /&gt;789gfd18gf86&lt;BR /&gt;12fy56cd2296&lt;BR /&gt;789fy12hty89&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 08 Jun 2004 08:20:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299042#M711754</guid>
      <dc:creator>iranzo</dc:creator>
      <dc:date>2004-06-08T08:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299043#M711755</link>
      <description>I think this user wants to insert .'s in the string.&lt;BR /&gt; &lt;BR /&gt;This is a nasty way of doing it but it's all I can come up with at the moment.&lt;BR /&gt; &lt;BR /&gt;STRING="123456789abcdefg";&lt;BR /&gt;&lt;BR /&gt;a=`echo $STRING | cut -c1-4`&lt;BR /&gt;b=`echo $STRING | cut -c5-8`&lt;BR /&gt;c=`echo $STRING | cut -c9-12`&lt;BR /&gt;d=`echo $STRING | cut -c13-16`&lt;BR /&gt;&lt;BR /&gt;echo "$a.$b.$c.$d"</description>
      <pubDate>Tue, 08 Jun 2004 08:21:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299043#M711755</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-06-08T08:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299044#M711756</link>
      <description>Sorry, didn't realise you had a file of these and I over-did how many you want.&lt;BR /&gt; &lt;BR /&gt;Here's another nasty one (sorry Merijn) that does your whole file.&lt;BR /&gt; &lt;BR /&gt;perl -ne '($a,$b,$c)=($_=~/^(....)(....)(....)/);print "$a.$b.$c\n"' datafile</description>
      <pubDate>Tue, 08 Jun 2004 08:26:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299044#M711756</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-06-08T08:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299045#M711757</link>
      <description>The solution by harry is the best one to start with because it's general: that command will substitute every kind of string (x can be any char)&lt;BR /&gt;Describe better what u need to subst, for instance:&lt;BR /&gt;&lt;BR /&gt;# sed "s/^\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)/\1.\2.\3/"  &amp;lt; file1  &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;would change the beginning of every line of file1 in that way, writing the new file file2&lt;BR /&gt;while&lt;BR /&gt;&lt;BR /&gt;# sed "s/\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)$/\1.\2.\3/"  &amp;lt; file1  &amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;would change the ending part of every line of file1&lt;BR /&gt;&lt;BR /&gt;If you need to change in the middle you must specify better the subst you need, even with some line of example&lt;BR /&gt;&lt;BR /&gt;hope this helps&lt;BR /&gt;Cesare</description>
      <pubDate>Tue, 08 Jun 2004 08:36:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299045#M711757</guid>
      <dc:creator>Cesare Salvioni</dc:creator>
      <dc:date>2004-06-08T08:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299046#M711758</link>
      <description># export x=blah&lt;BR /&gt;# perl -pe 's/....(?:.)/$&amp;amp;$ENV{x}/g' your_file&lt;BR /&gt;512dfblah456rtblah89&lt;BR /&gt;789gfblahd18gfblah86&lt;BR /&gt;12fy5blah6cd22blah96&lt;BR /&gt;789fyblah12htyblah89&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Maybe even clearer with&lt;BR /&gt;&lt;BR /&gt;# env x=. perl -pe 's/....(?:.)/$&amp;amp;$ENV{x}/g' your_file&lt;BR /&gt;512df.456rt.89&lt;BR /&gt;789gf.d18gf.86&lt;BR /&gt;12fy5.6cd22.96&lt;BR /&gt;789fy.12hty.89&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN!</description>
      <pubDate>Tue, 08 Jun 2004 08:45:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299046#M711758</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-08T08:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299047#M711759</link>
      <description>perl -pe -i s/xxxxxxxxxxxxx/xxx.xxx.xxx.xxx/g filename</description>
      <pubDate>Wed, 09 Jun 2004 09:10:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299047#M711759</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2004-06-09T09:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: script insertion</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299048#M711760</link>
      <description>Two alternatives.  The first keeps things in the shell and is the most efficient:&lt;BR /&gt;&lt;BR /&gt;while read line&lt;BR /&gt;do&lt;BR /&gt;  var1=${line%????????}&lt;BR /&gt;  var3=${line#????????}&lt;BR /&gt;  var2=${line%$var3}&lt;BR /&gt;  var2=${var2#$var1}&lt;BR /&gt;  echo "${var1}.${var2}.${var3}"&lt;BR /&gt;done &amp;lt; filename&lt;BR /&gt;&lt;BR /&gt;The second uses awk:&lt;BR /&gt;&lt;BR /&gt;awk '{print substr($0,1,4} "." substr($0,5,4} "." substr($0,9)}' filname&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 19 Jun 2004 12:01:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-insertion/m-p/3299048#M711760</guid>
      <dc:creator>Dan Martin_1</dc:creator>
      <dc:date>2004-06-19T12:01:48Z</dc:date>
    </item>
  </channel>
</rss>

