<?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: problem with awk script.. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913179#M763873</link>
    <description>hmmm i tryed both&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;grep: illegal option -- f&lt;BR /&gt;Usage: grep -hblcnsviw pattern file . . .&lt;BR /&gt;&lt;BR /&gt;I got this error..</description>
    <pubDate>Thu, 14 Dec 2006 11:33:40 GMT</pubDate>
    <dc:creator>amonamon</dc:creator>
    <dc:date>2006-12-14T11:33:40Z</dc:date>
    <item>
      <title>problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913171#M763865</link>
      <description>Hello I am trying to firure what is wrong with this script..but it does not work..here is what I tryed:&lt;BR /&gt;nawk -F"|" '&lt;BR /&gt;{ mo=substr($1,16,2)&lt;BR /&gt;  day=substr($1,18,2)}&lt;BR /&gt;{print $15"|2007|"mo"|"day;} ' $1 &amp;gt;  final&lt;BR /&gt;&lt;BR /&gt;so basicly from my input file $1 with substring function I want to assign mo and day variable and have final file..&lt;BR /&gt;maybe it is not right pleace to assign mo and day in this part?? I am using KSH..&lt;BR /&gt;&lt;BR /&gt;thanks..</description>
      <pubDate>Thu, 14 Dec 2006 10:21:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913171#M763865</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-12-14T10:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913172#M763866</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;What doesn't work?  Using your script and this input:&lt;BR /&gt;&lt;BR /&gt;# echo "...............12142007"|./myscript&lt;BR /&gt;&lt;BR /&gt;...yields:&lt;BR /&gt;&lt;BR /&gt;|2007|12|14&lt;BR /&gt;&lt;BR /&gt;...where './myscript' is as you wrote (using 'awk').&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 14 Dec 2006 10:32:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913172#M763866</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-14T10:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913173#M763867</link>
      <description>Hi,&lt;BR /&gt;how about:&lt;BR /&gt;nawk -F"|" '{ mo=substr($0,16,2); day=substr($0,18,2)} {print $15"|2007|"mo"|"day;} ' $1 &amp;gt; final&lt;BR /&gt;&lt;BR /&gt;May be helpful if you provided input and expected output.</description>
      <pubDate>Thu, 14 Dec 2006 10:37:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913173#M763867</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-12-14T10:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913174#M763868</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if Peter's tip is ($0 is the complete line of input) not what you mean: Do you want to extract the day+month information from the filename you supply?&lt;BR /&gt;Then use, use&lt;BR /&gt;&lt;BR /&gt;nawk -F"|" 'FNR==1 {mo=substr(FILENAME,16,2)&lt;BR /&gt;day=substr(FILENAME,18,2)}&lt;BR /&gt;{print $15"|2007|"mo"|"day;}' in1 in2 .. &amp;gt;final&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Thu, 14 Dec 2006 10:52:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913174#M763868</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-12-14T10:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913175#M763869</link>
      <description>Peter Nikitka that is what I wanted...Thanks a lot everyone..</description>
      <pubDate>Thu, 14 Dec 2006 11:06:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913175#M763869</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-12-14T11:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913176#M763870</link>
      <description>Can you provide sample input and how the output should look like?</description>
      <pubDate>Thu, 14 Dec 2006 11:08:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913176#M763870</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-12-14T11:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913177#M763871</link>
      <description>again me...:(&lt;BR /&gt;&lt;BR /&gt;now I have file1:&lt;BR /&gt;&lt;BR /&gt;232323|2007|12|09&lt;BR /&gt;343434|2007|12|09&lt;BR /&gt;565656|2007|12|09&lt;BR /&gt;898989|2007|12|09&lt;BR /&gt;090909|2007|12|09&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;BR /&gt;and file 2:&lt;BR /&gt;&lt;BR /&gt;232323&lt;BR /&gt;343434&lt;BR /&gt;343433&lt;BR /&gt;343432&lt;BR /&gt;343431&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;BR /&gt;My result that does not work OK with command grep -v -f file1 file2&lt;BR /&gt;&lt;BR /&gt;and output should be:&lt;BR /&gt;&lt;BR /&gt;232323|2007|12|09&lt;BR /&gt;343434|2007|12|09&lt;BR /&gt;&lt;BR /&gt;thanks friends..</description>
      <pubDate>Thu, 14 Dec 2006 11:20:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913177#M763871</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-12-14T11:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913178#M763872</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;# grep -f file2 file1 &lt;BR /&gt;&lt;BR /&gt;...you have the pattern file and the input file reversed and don't want the '-v'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 14 Dec 2006 11:30:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913178#M763872</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-12-14T11:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913179#M763873</link>
      <description>hmmm i tryed both&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;grep: illegal option -- f&lt;BR /&gt;Usage: grep -hblcnsviw pattern file . . .&lt;BR /&gt;&lt;BR /&gt;I got this error..</description>
      <pubDate>Thu, 14 Dec 2006 11:33:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913179#M763873</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-12-14T11:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913180#M763874</link>
      <description>How about using the join(1) command:&lt;BR /&gt;&lt;BR /&gt;# join -1 1 -2 1 -t'|' -o 1.1 1.2 1.3 1.4 file1 file2</description>
      <pubDate>Thu, 14 Dec 2006 12:07:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913180#M763874</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-12-14T12:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913181#M763875</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Based on the grep error message you provided, it doesn't appear you're using HP-UX (SunOS, perhaps?).&lt;BR /&gt;&lt;BR /&gt;If that's the case, try:&lt;BR /&gt;&lt;BR /&gt;$ /usr/xpg4/bin/grep -f file2 file1&lt;BR /&gt;&lt;BR /&gt;or:&lt;BR /&gt;&lt;BR /&gt;$ grep `cat file2` file1&lt;BR /&gt;&lt;BR /&gt;PCS&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Dec 2006 12:24:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913181#M763875</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-12-14T12:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913182#M763876</link>
      <description>sandman it works..but I do not understand a code..I never worked with join..I am trying to gigure it in man join..but it goes slow..if U could explain little..&lt;BR /&gt;&lt;BR /&gt;grep 'cat file1' file2 does not work..&lt;BR /&gt;&lt;BR /&gt;thanks friends..&lt;BR /&gt;&lt;BR /&gt;cheers..&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Dec 2006 02:22:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913182#M763876</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-12-18T02:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913183#M763877</link>
      <description>The join(1) example was based on the input you had provided, i.e.&lt;BR /&gt;&lt;BR /&gt;file1:&lt;BR /&gt;&lt;BR /&gt;232323|2007|12|09&lt;BR /&gt;343434|2007|12|09&lt;BR /&gt;565656|2007|12|09&lt;BR /&gt;898989|2007|12|09&lt;BR /&gt;090909|2007|12|09&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;BR /&gt;file 2:&lt;BR /&gt;&lt;BR /&gt;232323&lt;BR /&gt;343434&lt;BR /&gt;343433&lt;BR /&gt;343432&lt;BR /&gt;343431&lt;BR /&gt;..&lt;BR /&gt;..&lt;BR /&gt;&lt;BR /&gt;# join -1 1 -2 1 -t'|' -o 1.1 1.2 1.3 1.4 file1 file2&lt;BR /&gt;&lt;BR /&gt;The join(1) example above "glues" the two files (file1 and file2) together on the fields that are common to both...which is field 1 as shown by command line options -&amp;gt; "-1 1 -2 1".&lt;BR /&gt;&lt;BR /&gt;The field separator is the pipe character -t'|' (needs to be escaped or quoted as it has special meaning to the shell, and the output should consist of all fields from the first file -&amp;gt; "-o 1.1 1.2 1.3 1.4".&lt;BR /&gt;&lt;BR /&gt;imho...not sure why the grep command by JRF is not working for you. It works perfectly on my HP-UX box. Are you using HP-UX or some other variant?&lt;BR /&gt;&lt;BR /&gt;~hope it helps</description>
      <pubDate>Mon, 18 Dec 2006 10:13:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913183#M763877</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-12-18T10:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913184#M763878</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;of course JRF's solution works for Solaris as well - but you have to use the POSIX compliant binary:&lt;BR /&gt;&lt;BR /&gt;/usr/xpg4/bin/grep -f file2 file1&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Mon, 18 Dec 2006 11:13:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913184#M763878</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-12-18T11:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: problem with awk script..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913185#M763879</link>
      <description>thanks..a lot&lt;BR /&gt;&lt;BR /&gt;yes /usr/xpg4/bin/grep -f file2 file1&lt;BR /&gt; works fine on my solaris..&lt;BR /&gt;&lt;BR /&gt;thanks guys,&lt;BR /&gt;&lt;BR /&gt;cheers,</description>
      <pubDate>Tue, 19 Dec 2006 02:00:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-awk-script/m-p/3913185#M763879</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-12-19T02:00:12Z</dc:date>
    </item>
  </channel>
</rss>

