<?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 shell script - reading folder in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806299#M779807</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.gnu.org/software/gawk/manual/html_node/Quoting.html" target="_blank"&gt;http://www.gnu.org/software/gawk/manual/html_node/Quoting.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here there is many example more readable than that I gave you for single quote in awk.&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
    <pubDate>Fri, 16 Jun 2006 04:29:06 GMT</pubDate>
    <dc:creator>Enrico P.</dc:creator>
    <dc:date>2006-06-16T04:29:06Z</dc:date>
    <item>
      <title>problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806286#M779794</link>
      <description>Hello..&lt;BR /&gt;&lt;BR /&gt;I have a strange problem with my shell script..I have in folder meny txt and doc files I am only interested in txt files..how can I read certan data from each file and write it back to one file..&lt;BR /&gt;&lt;BR /&gt;any ideas?&lt;BR /&gt;&lt;BR /&gt;I have like 300 txt files in one folder and there is in each file peace of info that I need each file has this structure:&lt;BR /&gt;&lt;BR /&gt;mysql -u &lt;USER&gt; -h &lt;HOSTNAME&gt; -p &lt;BR /&gt;THIS LINE IS TARGET&lt;BR /&gt;&lt;BR /&gt;so basicly I only need last line from txt file..tail -1 is target value..&lt;BR /&gt;&lt;BR /&gt;any ideas or start code??&lt;/HOSTNAME&gt;&lt;/USER&gt;</description>
      <pubDate>Thu, 15 Jun 2006 07:21:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806286#M779794</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-06-15T07:21:20Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806287#M779795</link>
      <description>for a in *.txt&lt;BR /&gt;do&lt;BR /&gt;tail -1 $a &amp;gt;&amp;gt; newfile&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jun 2006 07:28:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806287#M779795</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2006-06-15T07:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806288#M779796</link>
      <description>If you mean by txt and doc files as .txt and .doc files, then you can use the following&lt;BR /&gt;&lt;BR /&gt;for i in `ls -1 *.txt`&lt;BR /&gt;do&lt;BR /&gt;tail -1 $i &amp;gt;&amp;gt; ouputfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad</description>
      <pubDate>Thu, 15 Jun 2006 07:30:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806288#M779796</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-06-15T07:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806289#M779797</link>
      <description>find . -type f -name '*.txt' -exec tail -1 {} &amp;gt;&amp;gt; accum.txt \;</description>
      <pubDate>Thu, 15 Jun 2006 07:35:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806289#M779797</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-06-15T07:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806290#M779798</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;for FILE in `ls`; do&lt;BR /&gt;if tail -1 $FILE|grep ^mysql &amp;gt;&amp;gt; /dev/null; then&lt;BR /&gt;tail -1 $FILE &amp;gt;&amp;gt; ouputfile&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Thu, 15 Jun 2006 07:38:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806290#M779798</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-06-15T07:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806291#M779799</link>
      <description>thanks you guys gave me a good hint...thanks for code..</description>
      <pubDate>Thu, 15 Jun 2006 09:02:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806291#M779799</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-06-15T09:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806292#M779800</link>
      <description>If the lines of interest are always in .txt files contained in one directory (/folder for example), and the line that you are interested in is always "mysql -u", then the following should work just fine:&lt;BR /&gt;&lt;BR /&gt;grep 'mysql -u' *.txt &amp;gt; accum.txt&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Jun 2006 10:45:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806292#M779800</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2006-06-15T10:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806293#M779801</link>
      <description>thanks but tail has different values not always same..&lt;BR /&gt;&lt;BR /&gt;I figure it out..but now I have anothe small problem..&lt;BR /&gt;&lt;BR /&gt;I have this:&lt;BR /&gt;awk '{printf("INSERT INTO akcije (date, time, target1, target, action) VALUES ('%s','%s','%s','%s','%s');\n",substr($0,0,6),substr($0,8,17),substr($0,25,8),substr($0,33,6),substr($0,48,11));}' ca &amp;gt; CAndA.sq&lt;BR /&gt;&lt;BR /&gt;result is: from CAndA.sq file:&lt;BR /&gt;..&lt;BR /&gt;...&lt;BR /&gt;INSERT INTO akcije (date, time, target1, target, action) VALUES (20060524,145222,5431,876,west);&lt;BR /&gt;...&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;which is not good command for mysql it needs to be like this:&lt;BR /&gt;&lt;BR /&gt;INSERT INTO akcije (date, time, target1, target, action) VALUES ('20060524','145222','5431','876','west');&lt;BR /&gt;&lt;BR /&gt;how can I show those ''...&lt;BR /&gt;I also tryed with \' insted just ' but same result..any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks..</description>
      <pubDate>Fri, 16 Jun 2006 00:59:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806293#M779801</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-06-16T00:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806294#M779802</link>
      <description>Hi,&lt;BR /&gt;try&lt;BR /&gt;&lt;BR /&gt;awk '{printf("INSERT INTO akcije (date, time, target1, target, action) VALUES ('%s','%s','%s','%s','%s');\n",substr($0,0,6),substr($0,8,17),substr($0,25,8),substr($0,3&lt;BR /&gt;3,6),substr($0,48,11));}' ca |sed s/\'//g &amp;gt; CAndA.sq&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Fri, 16 Jun 2006 03:09:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806294#M779802</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-06-16T03:09:44Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806295#M779803</link>
      <description>thanks for help but I get a same result with sed command...&lt;BR /&gt;&lt;BR /&gt;same with this sed as without sed..</description>
      <pubDate>Fri, 16 Jun 2006 03:35:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806295#M779803</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-06-16T03:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806296#M779804</link>
      <description>Sorry,&lt;BR /&gt;try to put the &lt;BR /&gt;&lt;BR /&gt;"'"'"'"&lt;BR /&gt;&lt;BR /&gt;before and after the substr function:&lt;BR /&gt;&lt;BR /&gt;awk '{printf("INSERT INTO akcije (date, time, target1, target, action) VALUES ('%s','%s','%s','%s','%s');\n","'"'"'"substr($0,0,6)"'"'"'","'"'"'"substr($0,8,17)"'"'"'","'"'"'"substr($0,25,8)"'"'"'","'"'"'"substr($0,3&lt;BR /&gt;3,6)"'"'"'","'"'"'"substr($0,48,11)"'"'"'");}' ca &amp;gt; CAndA.sq &lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Fri, 16 Jun 2006 04:08:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806296#M779804</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-06-16T04:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806297#M779805</link>
      <description>Hi,&lt;BR /&gt;in my test it work:&lt;BR /&gt;&lt;BR /&gt;awk '{print "'"'"'"substr($2,2,5)"'"'"'","'"'"'"substr($2,2,5)"'"'"'"}' test&lt;BR /&gt;&lt;BR /&gt;'prova' 'prova'&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Fri, 16 Jun 2006 04:12:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806297#M779805</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-06-16T04:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806298#M779806</link>
      <description>Enrico...this works perfect...thanks guys for this help..&lt;BR /&gt;&lt;BR /&gt;Cheers,</description>
      <pubDate>Fri, 16 Jun 2006 04:21:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806298#M779806</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2006-06-16T04:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem with shell script - reading folder</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806299#M779807</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.gnu.org/software/gawk/manual/html_node/Quoting.html" target="_blank"&gt;http://www.gnu.org/software/gawk/manual/html_node/Quoting.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Here there is many example more readable than that I gave you for single quote in awk.&lt;BR /&gt;&lt;BR /&gt;Enrico</description>
      <pubDate>Fri, 16 Jun 2006 04:29:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-shell-script-reading-folder/m-p/3806299#M779807</guid>
      <dc:creator>Enrico P.</dc:creator>
      <dc:date>2006-06-16T04:29:06Z</dc:date>
    </item>
  </channel>
</rss>

