<?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 question in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016771#M96464</link>
    <description>&lt;P&gt;What is your "key" for info you want to take from that other file? You may want to look at join(1), after you sort the two files on their key.&lt;BR /&gt;&lt;BR /&gt;If the number of lines in your two files is not too big, you could read your new file with awk and make an associative array then read in your data file and just replace that column E with data in the array that matches.&lt;BR /&gt;&lt;BR /&gt;If your separator is a ":", then you want awk -F:&lt;/P&gt;</description>
    <pubDate>Mon, 26 Sep 2011 03:24:02 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2011-09-26T03:24:02Z</dc:date>
    <item>
      <title>vi question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016770#M96463</link>
      <description>Hello,&lt;BR /&gt;I have minimaly used sed and awk stuffs.&lt;BR /&gt;Now i have a file which has a user data seperated with :&lt;BR /&gt;In which i have to replace a coulmn E(has user dept) with new information. some users have multiple entries in the file . How can i script to replace a particular column with new info (i have a file with the new info) &lt;BR /&gt;Thanks in advance</description>
      <pubDate>Sun, 10 Jun 2007 01:51:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016770#M96463</guid>
      <dc:creator>navin</dc:creator>
      <dc:date>2007-06-10T01:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016771#M96464</link>
      <description>&lt;P&gt;What is your "key" for info you want to take from that other file? You may want to look at join(1), after you sort the two files on their key.&lt;BR /&gt;&lt;BR /&gt;If the number of lines in your two files is not too big, you could read your new file with awk and make an associative array then read in your data file and just replace that column E with data in the array that matches.&lt;BR /&gt;&lt;BR /&gt;If your separator is a ":", then you want awk -F:&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2011 03:24:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016771#M96464</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-09-26T03:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: vi question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016772#M96465</link>
      <description>Hello Navin,&lt;BR /&gt;&lt;BR /&gt;Looks like you want to modify /etc/passwd. &lt;BR /&gt;&lt;BR /&gt;A quick one came to my mind is here. Below you are excluding the column 5 (column E) from the original file and redirect the result to file1&lt;BR /&gt;&lt;BR /&gt;#awk -F: 'BEGIN {  OFS=":" } { $5 = "";  print  }' /etc/passwd &amp;gt; file1&lt;BR /&gt;&lt;BR /&gt;Now you are merging the file1 with the newinfo file which contains the new info and redirect that result to a file called result&lt;BR /&gt;&lt;BR /&gt;#paste -d: file1 newinfo &amp;gt; result&lt;BR /&gt;&lt;BR /&gt;Finally you are extracting &lt;BR /&gt;#awk -F: 'BEGIN {  OFS=":" } {print $1, $2, $3, $4, $8, $6, $7}' result &amp;gt; final&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#diff /etc/passwd final&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Rasheed Tamton.</description>
      <pubDate>Sun, 10 Jun 2007 04:43:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016772#M96465</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2007-06-10T04:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: vi question</title>
      <link>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016773#M96466</link>
      <description>A sample of the replacement file and the file to be replaced posted here will help in providing an accurate solution. And as mentioned the files need a common key on which they need to be joined in order for the substitutions to take place.</description>
      <pubDate>Sun, 10 Jun 2007 08:41:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/vi-question/m-p/4016773#M96466</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-06-10T08:41:54Z</dc:date>
    </item>
  </channel>
</rss>

