<?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: inserting delimiters in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137031#M688799</link>
    <description>&amp;gt; [...] Closing thread now&lt;BR /&gt;&lt;BR /&gt;Ha!  As if that could stop me...&lt;BR /&gt;&lt;BR /&gt;bash$ echo 'user1,YNNNNNNNNN' | \&lt;BR /&gt;sed -e 's/,/ /' -e 's/\([NY]\)/\1 /g' -e 's/ /,/g' -e 's/,$//g'&lt;BR /&gt;user1,Y,N,N,N,N,N,N,N,N,N</description>
    <pubDate>Fri, 24 Oct 2008 02:43:24 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2008-10-24T02:43:24Z</dc:date>
    <item>
      <title>inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137022#M688790</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt;I need advise on how to format strings in a specific way.&lt;BR /&gt;&lt;BR /&gt;I have this data extracted from the passwd file&lt;BR /&gt;&lt;BR /&gt;user1,YNNNNNNNNNNNNNNNNNNN&lt;BR /&gt;user2,YNNNNNNYYNNNNNNNNNNN&lt;BR /&gt;&lt;BR /&gt;field1 = username&lt;BR /&gt;field2 = user flags in the descriptions field&lt;BR /&gt;&lt;BR /&gt;from the above format I wanted to create this output:&lt;BR /&gt;&lt;BR /&gt;user1,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N&lt;BR /&gt;user2,Y,N,N,N,N,N,N,Y,Y,N,N,N,N,N,N,N,N,N,N&lt;BR /&gt;&lt;BR /&gt;TIA!</description>
      <pubDate>Thu, 23 Oct 2008 02:55:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137022#M688790</guid>
      <dc:creator>cam9269</dc:creator>
      <dc:date>2008-10-23T02:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137023#M688791</link>
      <description>$ perl -lpe'($u,$f)=split /\W/; $_=join q(,),$u,split(//,$f)' &lt;INPUT /&gt;&lt;BR /&gt;&lt;BR /&gt;-lpe = loop trhough input and print $_ with newline&lt;BR /&gt;&lt;BR /&gt;First split on non-Word (The , and the new-line) saving username in $u, flags in $f.&lt;BR /&gt;&lt;BR /&gt;The re-join with commas, that username, and the flags where those are re-split on 'nothing'.&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 23 Oct 2008 04:43:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137023#M688791</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-10-23T04:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137024#M688792</link>
      <description>I you have exactly 20 and you don't want to write a script to break them up, you can use sed:&lt;BR /&gt;================================================&lt;BR /&gt;sed -e 's/\(.*,\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\1\2,\3,\4,\5,\6,\7,\8,\9,/' \&lt;BR /&gt;  -e 's/\(.*,.,.,.,.,.,.,.,.,\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)\(.\)/\1\2,\3,\4,\5,\6,\7,\8,\9,/' \&lt;BR /&gt;  -e 's/\(.*,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,\)\(.\)\(.\)\(.\)\(.\)/\1\2,\3,\4,\5/'</description>
      <pubDate>Thu, 23 Oct 2008 04:43:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137024#M688792</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-23T04:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137025#M688793</link>
      <description>Here's one example at an easier level.&lt;BR /&gt;Disadvantage is it calls multiple sed statements.  But it's easier to understand if you're just starting out.&lt;BR /&gt;&lt;BR /&gt;cat testdata&lt;BR /&gt;user1,YNNNNNNNNNNNNNNNNNNN&lt;BR /&gt;user2,YNNNNNNYYNNNNNNNNNNN&lt;BR /&gt;&lt;BR /&gt;cat testdata | tr "," " " | sed -e 's/Y/Y /g' | sed -e 's/N/N /g' | sed -e 's/ /,/g' | sed -e 's/$,//g'&lt;BR /&gt;&lt;BR /&gt;Output&lt;BR /&gt;user1,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N&lt;BR /&gt;user2,Y,N,N,N,N,N,N,Y,Y,N,N,N,N,N,N,N,N,N,N,N&lt;BR /&gt;&lt;BR /&gt;Approach&lt;BR /&gt;Decided a space will be the final Field delimeter.&lt;BR /&gt;So replaced that first comma with a space&lt;BR /&gt;  tr "," " " &lt;BR /&gt;Then put a space beside all Y's and N's&lt;BR /&gt;  sed -e 's/Y/Y /g' | sed -e 's/N/N /g'&lt;BR /&gt;Then replaced all spaces with a comma&lt;BR /&gt;  sed -e 's/ /,/g'&lt;BR /&gt;And then finally removing the comma that would be left at the end of the string from the previous step&lt;BR /&gt;  sed -e 's/,$//g'</description>
      <pubDate>Thu, 23 Oct 2008 08:00:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137025#M688793</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-10-23T08:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137026#M688794</link>
      <description>Well done guys!  Many, many thanks for the prompt replies.  I really need to get my scripting level up more.&lt;BR /&gt;&lt;BR /&gt;These options are superb!&lt;BR /&gt;&lt;BR /&gt;Thanks again!</description>
      <pubDate>Thu, 23 Oct 2008 21:20:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137026#M688794</guid>
      <dc:creator>cam9269</dc:creator>
      <dc:date>2008-10-23T21:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137027#M688795</link>
      <description>Thanks very much for the explanations KU. You deserve more that 10pts for this. :)</description>
      <pubDate>Thu, 23 Oct 2008 21:29:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137027#M688795</guid>
      <dc:creator>cam9269</dc:creator>
      <dc:date>2008-10-23T21:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137028#M688796</link>
      <description>Also to Hein, though I'm a newbie's newbie when it comes to perl scripting.  Appreciate it! it'll be my first 'hard' script to understand with perl.</description>
      <pubDate>Thu, 23 Oct 2008 21:32:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137028#M688796</guid>
      <dc:creator>cam9269</dc:creator>
      <dc:date>2008-10-23T21:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137029#M688797</link>
      <description>&lt;!--!*#--&gt;&amp;gt; Disadvantage is it calls multiple sed&lt;BR /&gt;&amp;gt; statements.&lt;BR /&gt;&lt;BR /&gt;It doesn't need to.  Multiple "-e" options&lt;BR /&gt;should do the job with one "sed".&lt;BR /&gt;&lt;BR /&gt;Of these two:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] 's/$,//g'&lt;BR /&gt;&amp;gt; [...] 's/,$//g'&lt;BR /&gt;&lt;BR /&gt;the second one works better.  And is "tr"&lt;BR /&gt;really needed?&lt;BR /&gt;&lt;BR /&gt;bash$ echo 'user1,YNNNNNNNNN' | \&lt;BR /&gt;sed -e 's/,/ /' -e 's/Y/Y /g' -e 's/N/N /g' -e 's/ /,/g' -e 's/,$//g'&lt;BR /&gt;user1,Y,N,N,N,N,N,N,N,N,N</description>
      <pubDate>Thu, 23 Oct 2008 21:48:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137029#M688797</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-23T21:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137030#M688798</link>
      <description>&amp;gt;Thanks very much for the explanations&lt;BR /&gt;&lt;BR /&gt;I can explain my regular expressions:&lt;BR /&gt;1) It captures everything up to the first comma and puts it back.&lt;BR /&gt;2) It then captures 8 characters and puts each back followed by a ",".&lt;BR /&gt;3) Since \# only works for 1..9, it does 8 more, after first accepting the first 8.&lt;BR /&gt;4) Then it does the final 4 after accepting the first 16.</description>
      <pubDate>Thu, 23 Oct 2008 23:13:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137030#M688798</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-23T23:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137031#M688799</link>
      <description>&amp;gt; [...] Closing thread now&lt;BR /&gt;&lt;BR /&gt;Ha!  As if that could stop me...&lt;BR /&gt;&lt;BR /&gt;bash$ echo 'user1,YNNNNNNNNN' | \&lt;BR /&gt;sed -e 's/,/ /' -e 's/\([NY]\)/\1 /g' -e 's/ /,/g' -e 's/,$//g'&lt;BR /&gt;user1,Y,N,N,N,N,N,N,N,N,N</description>
      <pubDate>Fri, 24 Oct 2008 02:43:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137031#M688799</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-10-24T02:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137032#M688800</link>
      <description>&lt;!--!*#--&gt;My solution is best explained by taking out all shortcuts:&lt;BR /&gt;&lt;BR /&gt;$ perl -lpe'($u,$f)=split /\W/; $_=join q(,),$u,split(//,$f)' &lt;INPUT /&gt;&lt;BR /&gt;&lt;BR /&gt;Really is...&lt;BR /&gt;&lt;BR /&gt;while ($line = &lt;STDIN&gt;) {&lt;BR /&gt;   ($user, $flags) = split (/\W/, $line);&lt;BR /&gt;   @letters = split(//, $flags);&lt;BR /&gt;   $new_line = join ',' , $user, @letters;&lt;BR /&gt;   print $new_line, "\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STDIN&gt;</description>
      <pubDate>Fri, 24 Oct 2008 02:43:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137032#M688800</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-10-24T02:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137033#M688801</link>
      <description>appreciate your enthusiasm Steven! I picked up on your advice :)&lt;BR /&gt;Thanks for the notes Hein! Will likely to play and consider it in the code too&lt;BR /&gt;&lt;BR /&gt;Cheers!</description>
      <pubDate>Fri, 24 Oct 2008 02:57:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137033#M688801</guid>
      <dc:creator>cam9269</dc:creator>
      <dc:date>2008-10-24T02:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137034#M688802</link>
      <description>&amp;gt;Steven: As if that could stop me...&lt;BR /&gt;&amp;gt;echo 'user1,YNNNNNNNNN' | \&lt;BR /&gt;sed -e 's/,/ /' -e 's/\([NY]\)/\1 /g' -e 's/ /,/g' -e 's/,$//g'&lt;BR /&gt;&lt;BR /&gt;It is obvious this isn't going to work if the user name is like "YESNO".&lt;BR /&gt;&lt;BR /&gt;I'm also not sure why you want to change to spaces then back?&lt;BR /&gt;Note: the "g" in 's/,$//g' is useless.</description>
      <pubDate>Fri, 24 Oct 2008 03:07:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137034#M688802</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-24T03:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137035#M688803</link>
      <description>i really, really appreciate all the inputs! :)</description>
      <pubDate>Fri, 24 Oct 2008 04:48:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137035#M688803</guid>
      <dc:creator>cam9269</dc:creator>
      <dc:date>2008-10-24T04:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: inserting delimiters</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137036#M688804</link>
      <description>&lt;!--!*#--&gt;You can also use awk.  Unfortunately I can't get split to work there with an empty RE.&lt;BR /&gt;awk -F, '&lt;BR /&gt;{&lt;BR /&gt;printf $1 ","&lt;BR /&gt;for (i=1; i &amp;lt; 20; ++i)&lt;BR /&gt;   printf substr($2,i,1) ","&lt;BR /&gt;print substr($2,20,1)&lt;BR /&gt;} '</description>
      <pubDate>Fri, 24 Oct 2008 05:24:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/inserting-delimiters/m-p/5137036#M688804</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-10-24T05:24:12Z</dc:date>
    </item>
  </channel>
</rss>

