<?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: File Content replacement in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873196#M860041</link>
    <description>Hello Hein,&lt;BR /&gt;&lt;BR /&gt;Please see attached file.</description>
    <pubDate>Wed, 01 Dec 2004 02:08:08 GMT</pubDate>
    <dc:creator>Pando</dc:creator>
    <dc:date>2004-12-01T02:08:08Z</dc:date>
    <item>
      <title>File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873191#M860036</link>
      <description>I have a file with the following line content..&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;SFC_ID,&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;I need a command or a perl command to add a "" after the SFC_ID, line.&lt;BR /&gt;&lt;BR /&gt;Maximum points for all correct!&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 00:04:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873191#M860036</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2004-12-01T00:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873192#M860037</link>
      <description>$ cat &amp;gt; x&lt;BR /&gt;...&lt;BR /&gt;SFC_ID,&lt;BR /&gt;...&lt;BR /&gt;$ perl -pe 's/(^SFC_ID,$)/\1""/' x&lt;BR /&gt;...&lt;BR /&gt;SFC_ID,""&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I use the (xxx) ... \1 construction to allow you to replace it with more elaborate match strings and append "" to whatever matches.&lt;BR /&gt;For example: 's/(^\w+_ID,$)/\1""/'&lt;BR /&gt;This will append to any line with an _ID token, including SFC_ID.&lt;BR /&gt;&lt;BR /&gt;- the () remebers into \1&lt;BR /&gt;- the ^ forces to start looking at Begin of line&lt;BR /&gt;- the $ forces the line to end right there.&lt;BR /&gt;&lt;BR /&gt;sprinkle with \s* and remove anchors as required.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 00:29:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873192#M860037</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-12-01T00:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873193#M860038</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;cat file | sed 's/SFC_ID,/SFC_ID,\"\"/' &amp;gt; file1&lt;BR /&gt;mv file1 file&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Gideon&lt;BR /&gt;( who is not sure about the \"\" part)&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 01:21:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873193#M860038</guid>
      <dc:creator>G. Vrijhoeven</dc:creator>
      <dc:date>2004-12-01T01:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873194#M860039</link>
      <description>Hello Hein,&lt;BR /&gt;&lt;BR /&gt;Thanks for the solution. I've tested it but when i open the file, there is no "" character strings after the SFC_ID, line.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 01:24:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873194#M860039</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2004-12-01T01:24:03Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873195#M860040</link>
      <description>&lt;BR /&gt;Well... it worked for me.&lt;BR /&gt;Apparently your actual datafile does not match what you included in the topic, and what I describe in the explanation for the match.&lt;BR /&gt;There might be trailing spaces. If you want to retain those before the "" then try:&lt;BR /&gt;&lt;BR /&gt;$ perl -pe 's/(^SFC_ID,\s*$)/\1""/' x&lt;BR /&gt;&lt;BR /&gt;or after:&lt;BR /&gt;&lt;BR /&gt;$ perl -pe 's/(^SFC_ID,)/\1""/' x&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;or gone:&lt;BR /&gt;&lt;BR /&gt;$ perl -pe 's/(^SFC_ID,)\s*$/\1""/' x&lt;BR /&gt;&lt;BR /&gt;Untested!&lt;BR /&gt;&lt;BR /&gt;If it still does not work, then please attach a text file with soem actual sample data.&lt;BR /&gt;&lt;BR /&gt;And... try to read up on 'regular expressions' "a gift for life"&lt;BR /&gt;&lt;BR /&gt;\s is 'whitespace such as blank or tab'&lt;BR /&gt;\s* is 'zero or more whitespaces'&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 01:33:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873195#M860040</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-12-01T01:33:14Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873196#M860041</link>
      <description>Hello Hein,&lt;BR /&gt;&lt;BR /&gt;Please see attached file.</description>
      <pubDate>Wed, 01 Dec 2004 02:08:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873196#M860041</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2004-12-01T02:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873197#M860042</link>
      <description>Well, it works fine over here.&lt;BR /&gt;I just saved your attachment to my pc.&lt;BR /&gt;Tossed it over to a drive on a (tru64) unix box as tmp.dat and it gives:&lt;BR /&gt;&lt;BR /&gt;# grep SFC tmp.dat&lt;BR /&gt;SFC_ID,&lt;BR /&gt;&lt;BR /&gt;# perl -pe 's/(^SFC_ID,$)/\1""/' tmp.dat | grep SFC&lt;BR /&gt;SFC_ID,""&lt;BR /&gt;&lt;BR /&gt;Removing the anchors also works, but migh latch on to replacements you did not intent:&lt;BR /&gt;&lt;BR /&gt;# perl -pe 's/(SFC_ID,)/\1""/' tmp.dat | grep SFC&lt;BR /&gt;SFC_ID,""&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Wed, 01 Dec 2004 10:30:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873197#M860042</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-12-01T10:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: File Content replacement</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873198#M860043</link>
      <description>Thanks for all the replies.</description>
      <pubDate>Thu, 02 Dec 2004 01:38:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-content-replacement/m-p/4873198#M860043</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2004-12-02T01:38:07Z</dc:date>
    </item>
  </channel>
</rss>

