<?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: awk or perl to place 'around word' in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943492#M412129</link>
    <description>How about the following aw construct:&lt;BR /&gt;&lt;BR /&gt;# tr "\t" " " &lt;INP&gt;&lt;/INP&gt;&lt;BR /&gt;cheers!</description>
    <pubDate>Tue, 29 Nov 2005 19:32:37 GMT</pubDate>
    <dc:creator>Sandman!</dc:creator>
    <dc:date>2005-11-29T19:32:37Z</dc:date>
    <item>
      <title>awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943484#M412121</link>
      <description>I have a tab deliminated file (SQL LOAD)&lt;BR /&gt;I need to surround the field by '  ', so it can be inserted into the database.&lt;BR /&gt;Also if I could, do a unique on the file and only pull the one instance of the file.&lt;BR /&gt;&lt;BR /&gt;File&lt;BR /&gt;SLAMTIDSQL     345 TEST SQL LOAD&lt;BR /&gt;TIDDLAMSQL     678 TEST SQL LOAD&lt;BR /&gt;TESTIDSQL1     111 TESTING LOAD&lt;BR /&gt;LAURATEST1     188 HOME&lt;BR /&gt;TIDSLAMSQL     678 TEST SQL LOAD&lt;BR /&gt;LAURATEST1     188 HOME&lt;BR /&gt;&lt;BR /&gt;Need to be like:&lt;BR /&gt;'SLAMTIDSQL','345 TEST SQL LOAD'&lt;BR /&gt;'TIDDLAMSQL','678 TEST SQL LOAD'&lt;BR /&gt;'TESTIDSQL1','111 TESTING LOAD'&lt;BR /&gt;'LAURATEST1','188 HOME'&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Nov 2005 15:06:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943484#M412121</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2005-11-29T15:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943485#M412122</link>
      <description>Neither awk nor perl, but will work:&lt;BR /&gt;&lt;BR /&gt;ex filename &amp;lt;&lt;EOD&gt;&lt;/EOD&gt;1,\$s/^/'/&lt;BR /&gt;1,\$s/$/'/&lt;BR /&gt;1,\$s/    /','/&lt;BR /&gt;wq!&lt;BR /&gt;EOD</description>
      <pubDate>Tue, 29 Nov 2005 15:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943485#M412122</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2005-11-29T15:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943486#M412123</link>
      <description>Hi LHradowy  ,&lt;BR /&gt;&lt;BR /&gt;To do this , you can take help of vi.&lt;BR /&gt;&lt;BR /&gt;1. use vi to add ' at both end.&lt;BR /&gt;   :%s/^/'/g&lt;BR /&gt;   :%s/$/'/g&lt;BR /&gt;&lt;BR /&gt;save the file in diff name. say aa&lt;BR /&gt;&lt;BR /&gt;2. cut the first column to a diff file. aa.1&lt;BR /&gt;# cat aa | awk '{print $1}' &amp;gt; aa.1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3. vi aa.1&lt;BR /&gt;:%s/$/','/g&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;4. # cat aa | awk '{print $2 , $3 , $4 , $5}' &amp;gt; aa.2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;5. # paste aa.1 aa.2 &amp;gt; aa.final&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raj.</description>
      <pubDate>Tue, 29 Nov 2005 15:36:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943486#M412123</guid>
      <dc:creator>Raj D.</dc:creator>
      <dc:date>2005-11-29T15:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943487#M412124</link>
      <description>Create a simple awk script, my.awk&lt;BR /&gt;----------------------&lt;BR /&gt;{&lt;BR /&gt;  printf("'%s','",$1)&lt;BR /&gt;  i = 2&lt;BR /&gt;  while (i &amp;lt; NF)&lt;BR /&gt;    {&lt;BR /&gt;      printf("%s ",$(i))&lt;BR /&gt;      ++i&lt;BR /&gt;    }&lt;BR /&gt;  printf("%s'\n",$(i))&lt;BR /&gt;}&lt;BR /&gt;----------------------------&lt;BR /&gt;awk -f my.awk infile &amp;gt; outfile&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Nov 2005 15:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943487#M412124</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-11-29T15:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943488#M412125</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Given the perl script 'perl.pl':&lt;BR /&gt;&lt;BR /&gt;# cat perl.pl&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    @flds = split /\s+/;&lt;BR /&gt;    print "'$flds[0]','@flds[1..$#flds]'\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Now, do:&lt;BR /&gt;&lt;BR /&gt;./perl.pl yourfile|sort -u&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 29 Nov 2005 15:40:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943488#M412125</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-11-29T15:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943489#M412126</link>
      <description>Oh yeah... you said you wanted only unique lines... easily added:&lt;BR /&gt;&lt;BR /&gt;sort -u filename &amp;gt; newfile&lt;BR /&gt;ex newfile &amp;lt;&lt;EOD&gt;&lt;/EOD&gt;1,\$s/^/'/&lt;BR /&gt;1,\$s/$/'/&lt;BR /&gt;1,\$s/ /','/&lt;BR /&gt;wq!&lt;BR /&gt;EOD</description>
      <pubDate>Tue, 29 Nov 2005 15:43:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943489#M412126</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2005-11-29T15:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943490#M412127</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;the simple and slow approach:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;cat infile | while read a b&lt;BR /&gt;do&lt;BR /&gt;echo \'$a\',\'$b\' &amp;gt;&amp;gt;path_to_outfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Nov 2005 15:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943490#M412127</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2005-11-29T15:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943491#M412128</link>
      <description>JRF delimits on all whitespace, not on tabs&lt;BR /&gt;&lt;BR /&gt;# perl -ple'chomp;$_=join",",map{"\47$_\47"}split/\t/,$_,-1' file&lt;BR /&gt;&lt;BR /&gt;a5:/tmp 115 &amp;gt; cat file&lt;BR /&gt;SLAMTIDSQL      345 TEST SQL LOAD&lt;BR /&gt;TIDDLAMSQL      678 TEST SQL LOAD&lt;BR /&gt;TESTIDSQL1      111 TESTING LOAD&lt;BR /&gt;LAURATEST1      188 HOME&lt;BR /&gt;TIDSLAMSQL      678 TEST SQL LOAD&lt;BR /&gt;LAURATEST1      188 HOME&lt;BR /&gt;a5:/tmp 116 &amp;gt; cat -vet file                                                     SLAMTIDSQL^I345 TEST SQL LOAD$&lt;BR /&gt;TIDDLAMSQL^I678 TEST SQL LOAD$&lt;BR /&gt;TESTIDSQL1^I111 TESTING LOAD$&lt;BR /&gt;LAURATEST1^I188 HOME$&lt;BR /&gt;TIDSLAMSQL^I678 TEST SQL LOAD$&lt;BR /&gt;LAURATEST1^I188 HOME$&lt;BR /&gt;a5:/tmp 117 &amp;gt; perl -ple'chomp;$_=join",",map{"\47$_\47"}split/\t/,$_,-1' file&lt;BR /&gt;'SLAMTIDSQL','345 TEST SQL LOAD'&lt;BR /&gt;'TIDDLAMSQL','678 TEST SQL LOAD'&lt;BR /&gt;'TESTIDSQL1','111 TESTING LOAD'&lt;BR /&gt;'LAURATEST1','188 HOME'&lt;BR /&gt;'TIDSLAMSQL','678 TEST SQL LOAD'&lt;BR /&gt;'LAURATEST1','188 HOME'&lt;BR /&gt;a5:/tmp 118 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ who would use DBI &amp;amp; DBD::Whatever ]</description>
      <pubDate>Tue, 29 Nov 2005 17:51:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943491#M412128</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-11-29T17:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943492#M412129</link>
      <description>How about the following aw construct:&lt;BR /&gt;&lt;BR /&gt;# tr "\t" " " &lt;INP&gt;&lt;/INP&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Tue, 29 Nov 2005 19:32:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943492#M412129</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-11-29T19:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943493#M412130</link>
      <description>How about the following awk construct...&lt;BR /&gt;&lt;BR /&gt;# tr "\t" " " &lt;INP&gt;&lt;/INP&gt;&lt;BR /&gt;cheers!</description>
      <pubDate>Tue, 29 Nov 2005 19:33:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943493#M412130</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2005-11-29T19:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943494#M412131</link>
      <description>You can try as,&lt;BR /&gt;&lt;BR /&gt;# sed -e "s/\(^[^ ]*\) \(.*\)/'\1','\2'/" filename &amp;gt; tmp.file&lt;BR /&gt;# mv tmp.file filename&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Wed, 30 Nov 2005 00:51:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943494#M412131</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-30T00:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943495#M412132</link>
      <description>You can use perl to update the change in the same file with one liner as,&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e "s/(^[^ ]*)(.*)/'\$1','\$2'/" filename&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Wed, 30 Nov 2005 00:53:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943495#M412132</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-30T00:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943496#M412133</link>
      <description>Change perl solution as,&lt;BR /&gt;&lt;BR /&gt;# perl -pe "s/(^[^ ]*) (.*)/'\$1','\$2'/" &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;space needed.&lt;BR /&gt;&lt;BR /&gt;AWK solution:&lt;BR /&gt;&lt;BR /&gt;# awk -v tab="'" '{ printf tab$1tab","tab;for(i=2;i&lt;NF&gt; &amp;gt; out&lt;BR /&gt;# mv out &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/FILENAME&gt;&lt;/NF&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 30 Nov 2005 01:05:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943496#M412133</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-11-30T01:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: awk or perl to place 'around word'</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943497#M412134</link>
      <description>thanks</description>
      <pubDate>Wed, 18 Jan 2006 14:44:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-or-perl-to-place-around-word/m-p/4943497#M412134</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2006-01-18T14:44:47Z</dc:date>
    </item>
  </channel>
</rss>

