<?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 Script help in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329539#M13170</link>
    <description>I need your help!!!&lt;BR /&gt;&lt;BR /&gt;I need to know duplicated strings in two files.&lt;BR /&gt;One file has 1000line or so, and the other has 550 lines too.&lt;BR /&gt;The output that I want is printing the same string, so I will update new string.&lt;BR /&gt;&lt;BR /&gt;For example One file has strings like&lt;BR /&gt;&lt;BR /&gt;webbbs&lt;BR /&gt;ryujin&lt;BR /&gt;hanbangapple&lt;BR /&gt;yumso&lt;BR /&gt;sagua&lt;BR /&gt;nojuck&lt;BR /&gt;ryujin&lt;BR /&gt;gajossal&lt;BR /&gt;scfarm&lt;BR /&gt;kyulnara&lt;BR /&gt;dearpia&lt;BR /&gt;cwpodofarm&lt;BR /&gt;chungma&lt;BR /&gt;mealon&lt;BR /&gt;samyu...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The Other &lt;BR /&gt;&lt;BR /&gt;andonghoney&lt;BR /&gt;ansungfarm&lt;BR /&gt;apeace&lt;BR /&gt;appletop&lt;BR /&gt;apsanjayoun&lt;BR /&gt;bawoofarm&lt;BR /&gt;bitgolfarm&lt;BR /&gt;hanbangapple&lt;BR /&gt;bonghwangfarm&lt;BR /&gt;celesti&lt;BR /&gt;chuksukfarm&lt;BR /&gt;chungmaewon&lt;BR /&gt;chungpoongfarm&lt;BR /&gt;chunmafarm&lt;BR /&gt;dearpia&lt;BR /&gt;...&lt;BR /&gt;so as you see hanbangapple and dearpia are both in two files&lt;BR /&gt;&lt;BR /&gt;I could do know   duplicated strings are hanbangapple , dearpia and I can erase them one of files.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;what is the script for fit it? any tips..&lt;BR /&gt;</description>
    <pubDate>Tue, 13 Jul 2004 02:10:45 GMT</pubDate>
    <dc:creator>jackfiled</dc:creator>
    <dc:date>2004-07-13T02:10:45Z</dc:date>
    <item>
      <title>Script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329539#M13170</link>
      <description>I need your help!!!&lt;BR /&gt;&lt;BR /&gt;I need to know duplicated strings in two files.&lt;BR /&gt;One file has 1000line or so, and the other has 550 lines too.&lt;BR /&gt;The output that I want is printing the same string, so I will update new string.&lt;BR /&gt;&lt;BR /&gt;For example One file has strings like&lt;BR /&gt;&lt;BR /&gt;webbbs&lt;BR /&gt;ryujin&lt;BR /&gt;hanbangapple&lt;BR /&gt;yumso&lt;BR /&gt;sagua&lt;BR /&gt;nojuck&lt;BR /&gt;ryujin&lt;BR /&gt;gajossal&lt;BR /&gt;scfarm&lt;BR /&gt;kyulnara&lt;BR /&gt;dearpia&lt;BR /&gt;cwpodofarm&lt;BR /&gt;chungma&lt;BR /&gt;mealon&lt;BR /&gt;samyu...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The Other &lt;BR /&gt;&lt;BR /&gt;andonghoney&lt;BR /&gt;ansungfarm&lt;BR /&gt;apeace&lt;BR /&gt;appletop&lt;BR /&gt;apsanjayoun&lt;BR /&gt;bawoofarm&lt;BR /&gt;bitgolfarm&lt;BR /&gt;hanbangapple&lt;BR /&gt;bonghwangfarm&lt;BR /&gt;celesti&lt;BR /&gt;chuksukfarm&lt;BR /&gt;chungmaewon&lt;BR /&gt;chungpoongfarm&lt;BR /&gt;chunmafarm&lt;BR /&gt;dearpia&lt;BR /&gt;...&lt;BR /&gt;so as you see hanbangapple and dearpia are both in two files&lt;BR /&gt;&lt;BR /&gt;I could do know   duplicated strings are hanbangapple , dearpia and I can erase them one of files.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;what is the script for fit it? any tips..&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jul 2004 02:10:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329539#M13170</guid>
      <dc:creator>jackfiled</dc:creator>
      <dc:date>2004-07-13T02:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329540#M13171</link>
      <description>So you want to remove words which are duplicated in the files from one of the files.&lt;BR /&gt;&lt;BR /&gt;Using something like:&lt;BR /&gt;&lt;BR /&gt;cat file1 file2 | sort | uniq -d&lt;BR /&gt;&lt;BR /&gt;to list the same words.&lt;BR /&gt;&lt;BR /&gt;Then use sed or awk or your favourite text manipulation tool to remove it.. i.e.&lt;BR /&gt;&lt;BR /&gt;for WORD in $(cat file1 file2 | sort | uniq -d)&lt;BR /&gt;do&lt;BR /&gt;sed -e "/${WORD}/d" &amp;lt; file1 &amp;gt; file1.out&lt;BR /&gt;mv file1.out file1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;or some such..</description>
      <pubDate>Tue, 13 Jul 2004 03:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329540#M13171</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2004-07-13T03:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329541#M13172</link>
      <description>Hi,&lt;BR /&gt;If you have enought memory (i think it is possible because the length of files is small), you can store all lines from the file with no modifications in an array, then with awk read the other file and write out this lines that are not in the array.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;BR /&gt;You can do &lt;BR /&gt;awk -f script.awk file1 file2 &amp;gt; file3&lt;BR /&gt;&lt;BR /&gt;where file3 is the file2 without the strings that are in file1&lt;BR /&gt;&lt;BR /&gt;---- script.awk -----------&lt;BR /&gt;&lt;BR /&gt;BEGIN {&lt;BR /&gt;  flag_file1=1&lt;BR /&gt;  filename=" "&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;  if (filename==" ")    &lt;BR /&gt;     filename=FILENAME    &lt;BR /&gt;  if (filename!=FILENAME)&lt;BR /&gt;    flag_file1=0           &lt;BR /&gt;  if (flag_file1==1) {&lt;BR /&gt;     a[NR]=$0  &lt;BR /&gt;     num_lin=NR&lt;BR /&gt;  } else {&lt;BR /&gt;  exists=0&lt;BR /&gt;  for (i=1;i&amp;lt;=num_lin;i++) {&lt;BR /&gt;    if ($0==a[i])&lt;BR /&gt;        exists=1&lt;BR /&gt;  }&lt;BR /&gt;  if (exists==0)&lt;BR /&gt;    print&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;------------- end script -------------&lt;BR /&gt;&lt;BR /&gt;Cheers.&lt;BR /&gt;Frank.</description>
      <pubDate>Tue, 13 Jul 2004 03:38:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329541#M13172</guid>
      <dc:creator>Francisco J. Soler</dc:creator>
      <dc:date>2004-07-13T03:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script help</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329542#M13173</link>
      <description>hai,&lt;BR /&gt;&lt;BR /&gt; use grep to do this. Get one file whose line is less than another. Get line by line and grep that in two files. end, input file will be modified.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;# forum.ksh&lt;BR /&gt;set -x&lt;BR /&gt;&lt;BR /&gt;file1=$1&lt;BR /&gt;file2=$2&lt;BR /&gt;&lt;BR /&gt;input=""&lt;BR /&gt;newfile=/tmp/stringcheck.log&lt;BR /&gt;&lt;BR /&gt;# Remove file if exists&lt;BR /&gt;cp -p  $newfile &lt;BR /&gt;touch $newfile&lt;BR /&gt;&lt;BR /&gt;if [[ $(cat $file1 | wc -l) -lt $(cat $file2 | wc -l) ]]; then&lt;BR /&gt;  input=$file1&lt;BR /&gt;else  &lt;BR /&gt; input=$file2&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;while read line; do&lt;BR /&gt;  grep -q $line $file1 $file2&lt;BR /&gt;  if [[ $? -eq 0 ]]; then&lt;BR /&gt;   echo "$line is in $file1 and $file2"&lt;BR /&gt;  else&lt;BR /&gt;   echo "$line" &amp;gt;&amp;gt; $newfile&lt;BR /&gt;  fi&lt;BR /&gt;done &amp;lt; $input&lt;BR /&gt;&lt;BR /&gt;# To make the file without same string&lt;BR /&gt;cp $newfile $input &lt;BR /&gt;&lt;BR /&gt;## end ###&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Muthukumar</description>
      <pubDate>Tue, 13 Jul 2004 04:01:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-help/m-p/3329542#M13173</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-13T04:01:11Z</dc:date>
    </item>
  </channel>
</rss>

