<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>The UNIX and Linux Forums - Shell Programming and Scripting</title>
		<link>http://www.unix.com/</link>
		<description>Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.</description>
		<language>en</language>
		<lastBuildDate>Thu, 17 May 2012 02:33:16 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>5</ttl>
		<image>
			<url>http://linux.unix.com/images/misc/rss.jpg</url>
			<title>The UNIX and Linux Forums - Shell Programming and Scripting</title>
			<link>http://www.unix.com/</link>
		</image>
		<item>
			<title>looping through mysql select results in a shell script</title>
			<link>http://www.unix.com/shell-programming-scripting/186787-looping-through-mysql-select-results-shell-script.html</link>
			<pubDate>Thu, 17 May 2012 01:47:32 GMT</pubDate>
			<description><![CDATA[my query is like this 
 
 
 
Code: 
--------- 
  mysql -sN -e "select user_name, user_email, user_group from table name LIMIT 0, 10" | 
  while read user_name user_email user_group ; do 
 
 something]]></description>
			<content:encoded><![CDATA[<div>my query is like this<br />
<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->&nbsp; mysql -sN -e &quot;select user_name, user_email, user_group from table name LIMIT 0, 10&quot; |<br />
&nbsp; while read user_name user_email user_group ; do<br />
<br />
&nbsp;something<br />
<br />
<br />
&nbsp; done<!--ntend--></code><hr />
</div><br />
basically want to save the usernames and email to a group<br />
but the problem is if the email is empty, then <br />
the output is like<br />
username 2<br />
<br />
and then it thinks the email is 2<br />
when the email is actually blank<br />
<br />
<br />
<br />
<br />
so when i do read user_name user_email user_group<br />
and if the table is blank then the select returns<br />
user_name and user_group<br />
and then it thinks the email is the user_group<br />
<br />
if that makes sense<br />
<br />
do you know how to fix this?<br />
<br />
thanks!!</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>vanessafan99</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186787-looping-through-mysql-select-results-shell-script.html</guid>
		</item>
		<item>
			<title>Find a particular directory in multiple file systems and calculate total size</title>
			<link>http://www.unix.com/shell-programming-scripting/186781-find-particular-directory-multiple-file-systems-calculate-total-size.html</link>
			<pubDate>Wed, 16 May 2012 21:50:46 GMT</pubDate>
			<description><![CDATA[Hello : 
  
I need some help in writing a ksh script which will find a particular directory in all the file systems in a server and finally report the total size of the direcotry in all the file systems. 
  
Some thing like this.. 
  
find /u*/app/oracle -type d -name "product" -prune 
  
and then...]]></description>
			<content:encoded><![CDATA[<div>Hello :<br />
 <br />
I need some help in writing a ksh script which will find a particular directory in all the file systems in a server and finally report the total size of the direcotry in all the file systems.<br />
 <br />
Some thing like this..<br />
 <br />
find /u*/app/oracle -type d -name &quot;product&quot; -prune<br />
 <br />
and then iteratively report the size of the product directory per file system and report the total size for the directory in all file systems in the server.<br />
 <br />
Any help would be greatly appreciated. <br />
 <br />
Thanks in Advance.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>Sam1974</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186781-find-particular-directory-multiple-file-systems-calculate-total-size.html</guid>
		</item>
		<item>
			<title>Script to report database home in unix</title>
			<link>http://www.unix.com/shell-programming-scripting/186775-script-report-database-home-unix.html</link>
			<pubDate>Wed, 16 May 2012 21:03:35 GMT</pubDate>
			<description><![CDATA[Hello: 
  
I am trying to build a ksh shell script which would summarize space occupied by "product" directory under /u*/app/oracle 
and summarize and report the total size occupied by it in one server. 
  
Environment is this... 
  
HP UNIX 11i 
  
Korn Shell]]></description>
			<content:encoded><![CDATA[<div>Hello:<br />
 <br />
I am trying to build a ksh shell script which would summarize space occupied by &quot;product&quot; directory under /u*/app/oracle<br />
and summarize and report the total size occupied by it in one server.<br />
 <br />
Environment is this...<br />
 <br />
HP UNIX 11i<br />
 <br />
Korn Shell<br />
 <br />
 <br />
some thing like <br />
/u402/app/oracle/product<br />
du -s /u402/app/oracle/product<br />
24991150 /u402/app/oracle/product - A <br />
/u12/app/oracle/product<br />
du -s /u12/app/oracle/product<br />
12975244 /u12/app/oracle/product - B <br />
/u25/app/oracle/product<br />
du -s /u25/app/oracle/product<br />
11699776 /u25/app/oracle/product - C<br />
 <br />
Total size in MB ==&gt; A+B+C <br />
Some thing like this.<br />
Regards,<br />
Sammy</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>Sam1974</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186775-script-report-database-home-unix.html</guid>
		</item>
		<item>
			<title>Help needed in reading line value into variable</title>
			<link>http://www.unix.com/shell-programming-scripting/186771-help-needed-reading-line-value-into-variable.html</link>
			<pubDate>Wed, 16 May 2012 20:55:13 GMT</pubDate>
			<description>I have a file which has data in 8 lines: 
 
 
Code: 
--------- 
10 
34 
 6 
 1 
 4</description>
			<content:encoded><![CDATA[<div>I have a file which has data in 8 lines:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->10<br />
34<br />
&nbsp;6<br />
&nbsp;1<br />
&nbsp;4<br />
46<br />
67<br />
31<!--ntend--></code><hr />
</div>I am trying to read each value into each different variable so that I use these variables in preparing my report.<br />
<br />
Another option is to dynamically print each line values in the report like below:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->users with privA: line 1 value<br />
users with privB: line 2 value<br />
users with privC: line 3 value<br />
users with privD: line 4 value<br />
users with privE: line 5 value<br />
users with privF: line 6 value<br />
users with privG: line 7 value<br />
users with privH: line 8 value<!--ntend--></code><hr />
</div>Please help me out with the correct command<br />
<br />
Thanks in advance.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>sarat949</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186771-help-needed-reading-line-value-into-variable.html</guid>
		</item>
		<item>
			<title>Trying to extract domain and tld from list of urls.</title>
			<link>http://www.unix.com/shell-programming-scripting/186767-trying-extract-domain-tld-list-urls.html</link>
			<pubDate>Wed, 16 May 2012 19:23:52 GMT</pubDate>
			<description>I have done a fair amount of searching the threads, but I have not been able to cobble together a solution to my challenge.  What I am trying to do is to line edit a file that will leave behind only the domain and tld of a long list of urls.   The list looks something like this: 
 
Code: 
---------...</description>
			<content:encoded><![CDATA[<div>I have done a fair amount of searching the threads, but I have not been able to cobble together a solution to my challenge.  What I am trying to do is to line edit a file that will leave behind only the domain and tld of a long list of urls.   The list looks something like this:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->www.google.com<br />
ja.wikipedia.org<br />
bbc.co.uk<br />
fr-fr.facebook.com<!--ntend--></code><hr />
</div>and I would like to end up with:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->google.com<br />
wikipedia.org<br />
bbc.co.uk<br />
facebook.com<!--ntend--></code><hr />
</div>I prefer bash, but am learning ruby and <acronym title="Practical Extraction and Report Language">perl</acronym>....though not very good at them yet.  I have used ruby's URI function to extract the input links above...is there another ruby function I am overlooking for domain.tld?<br />
<br />
Thanks!</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>chamb1</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186767-trying-extract-domain-tld-list-urls.html</guid>
		</item>
		<item>
			<title>top 10 highest and lowest percentile from a column</title>
			<link>http://www.unix.com/shell-programming-scripting/186765-top-10-highest-lowest-percentile-column.html</link>
			<pubDate>Wed, 16 May 2012 19:05:44 GMT</pubDate>
			<description>Hi, I want to extract the the top 10 and lowest 10 percentile for a column of values. 
 
For example in column 2 for this file: 
 
 
Code: 
--------- 
JOE   1  
JAY   5 
JAM   6</description>
			<content:encoded><![CDATA[<div>Hi, I want to extract the the top 10 and lowest 10 percentile for a column of values.<br />
<br />
For example in column 2 for this file:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->JOE&nbsp;  1 <br />
JAY&nbsp;  5<br />
JAM&nbsp;  6<br />
JIL&nbsp;  8<br />
JIB&nbsp;  4<br />
JIH&nbsp;  3<br />
JIG&nbsp;  2<br />
JIT&nbsp;  7<br />
JAM&nbsp;  9<br />
MAR&nbsp;  10<!--ntend--></code><hr />
</div>The top 10 lowest will be:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->JOE&nbsp;  1<!--ntend--></code><hr />
</div>and the top 10 highest will be:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->MAR 10<!--ntend--></code><hr />
</div>If there is a quick way of doing this then it would be great<br />
<br />
Thanks</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>kylle345</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186765-top-10-highest-lowest-percentile-column.html</guid>
		</item>
		<item>
			<title>average each column in a file</title>
			<link>http://www.unix.com/shell-programming-scripting/186761-average-each-column-file.html</link>
			<pubDate>Wed, 16 May 2012 18:26:35 GMT</pubDate>
			<description>Hi, I tried to do this in excel but there is a limit to how many rows it can handle. 
 
All I need to do is average each column in a file and get the final value. 
 
My file looks something like this (obviously a lot larger): 
 
 
Code: 
--------- 
Joe HHR + 1 2 3 4 5 6 7 8</description>
			<content:encoded><![CDATA[<div>Hi, I tried to do this in excel but there is a limit to how many rows it can handle.<br />
<br />
All I need to do is average each column in a file and get the final value.<br />
<br />
My file looks something like this (obviously a lot larger):<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->Joe HHR + 1 2 3 4 5 6 7 8<br />
Jor HHR - 1 2 3 4 5 6 7 8<!--ntend--></code><hr />
</div>the output would be (average values only):<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->1 2 3 4 5 6 7 8<!--ntend--></code><hr />
</div>Thanks</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>kylle345</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186761-average-each-column-file.html</guid>
		</item>
		<item>
			<title>Extracting the last 10mins worth of data in a log file</title>
			<link>http://www.unix.com/shell-programming-scripting/186749-extracting-last-10mins-worth-data-log-file.html</link>
			<pubDate>Wed, 16 May 2012 17:03:29 GMT</pubDate>
			<description>Hi all, 
Hope someone here will be able to help me. Our system has some scripts that are run from a cron job every ten mins and is used to see how many error there are in that time frame. Problem is that in the scripts grep is used to find the data, but as the day goes on these log file grow to a...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
Hope someone here will be able to help me. Our system has some scripts that are run from a cron job every ten mins and is used to see how many error there are in that time frame. Problem is that in the scripts grep is used to find the data, but as the day goes on these log file grow to a huge size and the whole process is getting slower and slower.<br />
 <br />
What I need to do if figure out a smarter way of doing it. So what I was looking for is there some way I can extract the last 10 mins (even have this variable) worth of data from the logs, with out having to scan through the whole file.<br />
 <br />
I was think maybe of reading the file from the bottom up to 10 mins ago, some thing like the tac command, but the problem with the tac command is it will read the whole file which I want to avoid.<br />
 <br />
All the entries in the log file are timestamped in the following format:<br />
2012-05-16 17:00:46<br />
 <br />
I am on a linuix system and using ksh.<br />
Scripting is not a strong point of mine<br />
Thanks all in advance.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>Goldengreen</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186749-extracting-last-10mins-worth-data-log-file.html</guid>
		</item>
		<item>
			<title>pull out rows with specific criteria</title>
			<link>http://www.unix.com/shell-programming-scripting/186743-pull-out-rows-specific-criteria.html</link>
			<pubDate>Wed, 16 May 2012 16:44:55 GMT</pubDate>
			<description>Hi,  
I have a file with multiple columns and for column 5 I want to extract that row into another file if it is equal to or greater than a certain value. 
 
For example: 
 
 
Code: 
--------- 
FAR  4  5  7  LOP 
GAT  3  3  3  POL</description>
			<content:encoded><![CDATA[<div>Hi, <br />
I have a file with multiple columns and for column 5 I want to extract that row into another file if it is equal to or greater than a certain value.<br />
<br />
For example:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->FAR&nbsp; 4&nbsp; 5&nbsp; 7&nbsp; LOP<br />
GAT&nbsp; 3&nbsp; 3&nbsp; 3&nbsp; POL<!--ntend--></code><hr />
</div>I want values that are greater than 5 for column 4.  So the final file will look like this.<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->FAR&nbsp; 4&nbsp; 5&nbsp; 7&nbsp; LOP<!--ntend--></code><hr />
</div>Thanks<br />
<br />
Phil</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>phil_heath</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186743-pull-out-rows-specific-criteria.html</guid>
		</item>
		<item>
			<title>Monitoring log for FATAL in last 15mins only</title>
			<link>http://www.unix.com/shell-programming-scripting/186739-monitoring-log-fatal-last-15mins-only.html</link>
			<pubDate>Wed, 16 May 2012 16:33:53 GMT</pubDate>
			<description>Hi all, 
I need to develop the following script. Could anyone please provide me some inputs. 
 
1) Monitor the system log file (sys.log) for any lines in the parameter file that will contain all the different phrases of FATAL errors that the process has to scan for in the sys.log. 
 
If any FATAL...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
I need to develop the following script. Could anyone please provide me some inputs.<br />
<br />
1) Monitor the system log file (sys.log) for any lines in the parameter file that will contain all the different phrases of FATAL errors that the process has to scan for in the sys.log.<br />
<br />
If any FATAL messages are found then an email notification has to be sent.<br />
<br />
2) The process should look for errors only from the point of time when the last monitoring took place. For eg; if the first monitoring process ran at 8:00am CT, the next one that runs at 8:15 am should look for these errors from 8:01am time mark<br />
<br />
This is how the <b>sys.log</b> looks like:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->May 15 11:10:41 &lt;hostname&gt; xy_updserv[29245]: +++INFO+++ initialization complete<br />
May 15 11:10:48 &lt;hostname&gt; xy_qryserv[29243]: +++INFO+++ initialization complete<br />
May 15 11:10:49 &lt;hostname&gt; xy_qryserv[12345]: RPC: using socket receive timeout of 0 seconds<br />
May 15 11:10:49 &lt;hostname&gt; xy_updserv[13445]: RPC: using socket receive timeout of 0 seconds<br />
May 15 11:12:32 &lt;hostname&gt; xy_qryserv[12343]: +++ERROR+++ Warning: could not load '/abc/az/xyz/file.fe' <br />
May 15 11:27:21 &lt;hostname&gt; xy_qryserv[10905]: +++ERROR+++ Info: FATAL - data missing<br />
May 15 11:42:19 &lt;hostname&gt; xy_qryserv[731]: +++FATAL+++ initialization failed. Aborting...<!--ntend--></code><hr />
</div>This is how the <b>param file</b> looks like:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->+++ERROR+++ Info: FATAL - data missing<br />
+++FATAL+++ initialization failed. Aborting...<!--ntend--></code><hr />
</div>Thanks all!!<br />
<br />
<table width="90%" cellspacing="1" cellpadding="1" border="0" align="center">
	<tr>
		<td>
		<span class="smallfont"><strong>Moderator's Comments:</strong></span>
		</td>
	</tr>
	<tr>
		<td>
                 <table cellpadding="3" cellspacing="0" border="1">
		    <tr>
		     <td valign="middle" class="alt1">
	             <img align="left" src="http://linux.unix.com/images/icons/goldstar.png">
		     </td>
		     <td class="alt2">
		     <font color="#2B4782">Code tags for code, please.</font>
		     </td>
		     </tr>
                </table>
                </td>    
	</tr>
</table></div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>stunnerz_84</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186739-monitoring-log-fatal-last-15mins-only.html</guid>
		</item>
		<item>
			<title>Change numbers in a file, incrementing them</title>
			<link>http://www.unix.com/shell-programming-scripting/186723-change-numbers-file-incrementing-them.html</link>
			<pubDate>Wed, 16 May 2012 14:44:47 GMT</pubDate>
			<description><![CDATA[Hello, 
 
Here's a file of mine: 
 
 
Code: 
--------- 
key1:431 
key2:159 
key3:998]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
Here's a file of mine:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->key1:431<br />
key2:159<br />
key3:998<!--ntend--></code><hr />
</div>I need to change these keys to something bigger - and I actually need to shift them all by a range of 3.<br />
<br />
The output would be:<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->key1:434<br />
key2:162<br />
key3:1001<!--ntend--></code><hr />
</div>I can't find the propper <acronym title="Stream Editor">sed</acronym>/awk line that would alter all my lines.<br />
<br />
The plan-B would be to parse each line, get the value, increment it, and replace it. But I'm sure there's something smarter. .<br />
<br />
Thanks<br />
<br />
<table width="90%" cellspacing="1" cellpadding="1" border="0" align="center">
	<tr>
		<td>
		<span class="smallfont"><strong>Moderator's Comments:</strong></span>
		</td>
	</tr>
	<tr>
		<td>
                 <table cellpadding="3" cellspacing="0" border="1">
		    <tr>
		     <td valign="middle" class="alt1">
	             <img align="left" src="http://linux.unix.com/images/icons/goldstar.png">
		     </td>
		     <td class="alt2">
		     <font color="#2B4782">edit by bakunin: Please use &#91;CODE&#93;...&#91;/CODE&#93;-tags when posting code or terminal output. Thank you.</font>
		     </td>
		     </tr>
                </table>
                </td>    
	</tr>
</table></div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>fzd</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186723-change-numbers-file-incrementing-them.html</guid>
		</item>
		<item>
			<title>Multi-line filtering based on multi-line pattern in a file</title>
			<link>http://www.unix.com/shell-programming-scripting/186719-multi-line-filtering-based-multi-line-pattern-file.html</link>
			<pubDate>Wed, 16 May 2012 14:12:46 GMT</pubDate>
			<description>I have a file with data records separated by multiple equals signs, as below. 
  
========== 
RECORD 1 
========== 
RECORD 2 
DATA LINE 
========== 
RECORD 3 
==========</description>
			<content:encoded><![CDATA[<div>I have a file with data records separated by multiple equals signs, as below.<br />
 <br />
==========<br />
RECORD 1<br />
==========<br />
RECORD 2<br />
DATA LINE<br />
==========<br />
RECORD 3<br />
==========<br />
RECORD 4<br />
DATA LINE<br />
==========<br />
RECORD 5<br />
DATA LINE<br />
==========<br />
 <br />
I need to filter out all data from this file where the record has no data lines. So in the example above, I would need RECORD 1 and RECORD 3 to be filtered out, plus the extra rows of equals signs separating them. So I would like the output to be:<br />
 <br />
==========<br />
RECORD 2<br />
DATA LINE<br />
==========<br />
RECORD 4<br />
DATA LINE<br />
==========<br />
RECORD 5<br />
DATA LINE<br />
==========<br />
 <br />
I can get done whan I need on single lines, but I am stuck trying to match the pattern over multiple lines, and then deleting multiple lines.</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>Finja</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186719-multi-line-filtering-based-multi-line-pattern-file.html</guid>
		</item>
		<item>
			<title>assign multiple rows value to a variable using eval</title>
			<link>http://www.unix.com/shell-programming-scripting/186715-assign-multiple-rows-value-variable-using-eval.html</link>
			<pubDate>Wed, 16 May 2012 13:39:10 GMT</pubDate>
			<description><![CDATA[background : Solaris, ksh 
 
 
Code: 
--------- 
metresult="ooo 
> pp" 
ts=89 
eval append_${ts}="$metresult" 
bash: pp: command not found]]></description>
			<content:encoded><![CDATA[<div>background : Solaris, ksh<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->metresult=&quot;ooo<br />
&gt; pp&quot;<br />
ts=89<br />
eval append_${ts}=&quot;$metresult&quot;<br />
bash: pp: command not found<!--ntend--></code><hr />
</div>I want to create a variable which has in a part of its name a dynamically-established number (stored in another variable) usually I do this with eval command.  The problem I have now is that I want to assign to this variable a multiple row value and I get the error you see above (&quot;pp&quot; is the word from the second row from $metresult value.<br />
<br />
If I want to assign a single-row-value to such a variable using eval everything works fine :<br />
<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart--> metresult=&quot;ooo&quot;<br />
ts=89<br />
eval append_${ts}=&quot;$metresult&quot;<br />
echo $append_89<br />
ooo<!--ntend--></code><hr />
</div>I do something wrong syntactically speaking and I wonder if you have another approach. I do not want workarounds with arrays a.s.o. I only want to know this : how to assign multiple rows value to a variable using eval command<br />
<br />
THX</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>black_fender</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186715-assign-multiple-rows-value-variable-using-eval.html</guid>
		</item>
		<item>
			<title>Send correct exit code from child script back to parent</title>
			<link>http://www.unix.com/shell-programming-scripting/186713-send-correct-exit-code-child-script-back-parent.html</link>
			<pubDate>Wed, 16 May 2012 13:38:15 GMT</pubDate>
			<description><![CDATA[Hello all;  hope someone can help me cause I am going crazy trying to find a solution for  (what I think is simple) issue...looked hard up and down this forum and tried several "solutions" with no avail...so here's my issue: 
 
I have this (parent) script: copylsofdcmcadefttosftpwithmove.sh 
...]]></description>
			<content:encoded><![CDATA[<div>Hello all;  hope someone can help me cause I am going crazy trying to find a solution for  (what I think is simple) issue...looked hard up and down this forum and tried several &quot;solutions&quot; with no avail...so here's my issue:<br />
<br />
I have this (parent) script: <font color="Blue">copylsofdcmcadefttosftpwithmove.sh</font><br />
<br />
Inside this script I have this piece of code:<br />
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->if [ &quot;$flag&quot; = &quot;yes&quot; ]<br />
then<br />
&nbsp; &nbsp; &nbsp; &nbsp; /usr/local/bin/ssh $sftpserver mv $sftppath/$filenameshort $finaldirname&nbsp; &gt;&gt; ${_ftpdebug} 2&gt;&amp;1<br />
&nbsp; &nbsp; &nbsp; &nbsp; <font color="Red">ssh faunus:/home/dslmain/scripts/senddcmcadefttest.sh</font><br />
&nbsp; &nbsp; &nbsp; &nbsp; if [ $? -ne 0 ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;EXIT: &quot; $?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  exit<br />
&nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;DONE&quot;<br />
else<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;FAILED&quot;<br />
fi<!--ntend--></code><hr />
</div>I call another script via ssh (red text).<br />
<br />
This is the contents of the script: <font color="Red"><font color="Blue">senddcmcadefttest.sh</font><br />
<font color="Black"><div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Code:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left"><!--ntstart-->#!/bin/sh -x<br />
node=fid<br />
NODE=FAUNUS<br />
_Ymd=`date +%Y%m%d`<br />
indir=/home/dslmain/export/${node}/eft/in<br />
sentdir=/home/dslmain/export/${node}/eft/sent<br />
LOG=&quot;/home/dslmain/export/$node/eft/logs/eft.log.`date +%m%d`&quot;<br />
_temp=/utemp/tmp_logs/eftexists<br />
if [ -s $_temp ]<br />
then<br />
&nbsp; rm $_temp<br />
fi<br />
_ym=`date +%m%d`<br />
<br />
ls ${indir}/*${_ym}* &gt; $_temp<br />
if [ ! -s $_temp ]<br />
then<br />
&nbsp;  echo &quot;No EFT files detected&quot; &gt;&gt; ${LOG}<br />
&nbsp;  exit 1<br />
fi<br />
cd ${indir}<br />
for FILE in `cat $_temp|awk -F'/' '{print $NF}'`<br />
do<br />
&nbsp; if [ -s ${FILE} ]<br />
&nbsp; then<br />
&nbsp; &nbsp; echo &quot;Here _UPLOAD function would have run&quot;<br />
&nbsp; &nbsp; echo &quot;Snapshot of files of the day found on RBC FTP&quot; &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; A=1<br />
&nbsp; &nbsp; B=1<br />
&nbsp; &nbsp; echo $A &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; echo $B &gt;&gt; ${LOG} <br />
&nbsp; &nbsp; if [ ${A} -eq ${B} ]<br />
&nbsp; &nbsp; then<br />
&nbsp; &nbsp; &nbsp; echo &quot;${FILE} was successfully uploaded to RBC&quot; &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; &nbsp; echo &quot;&quot;&nbsp; &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; &nbsp; mv ${indir}/${FILE} ${sentdir}/${FILE}<br />
&nbsp; &nbsp; &nbsp; <font color="Red">exit 0</font><br />
&nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; echo &quot;${indir}/${FILE} failed to be loaded to RBC&quot; &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; &nbsp; echo &quot; &quot;&nbsp; &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; &nbsp; <font color="Red">exit 2</font><br />
&nbsp; &nbsp; fi<br />
&nbsp; else<br />
&nbsp; &nbsp; echo &quot;Sorry file dose not exist, or file is empty&quot; &gt;&gt; ${LOG}<br />
&nbsp; &nbsp; <font color="Red">exit 3</font><br />
&nbsp; fi<br />
done<!--ntend--></code><hr />
</div>So in the child script I have 3 different scenarios (in red) where the exit code will be either 0, 2 or 3...I want to pass the correct exit code back to the parent script </font></font>copylsofdcmcadefttosftpwithmove.sh so that it can be evaluated in the &quot;if&quot; statement...however $? is always coming back as &quot;0&quot;...<br />
<br />
Thanks for reading and any assistance.<br />
<br />
Regards<br />
Giuliano<br />
<br />
<table width="90%" cellspacing="1" cellpadding="1" border="0" align="center">
	<tr>
		<td>
		<span class="smallfont"><strong>Moderator's Comments:</strong></span>
		</td>
	</tr>
	<tr>
		<td>
                 <table cellpadding="3" cellspacing="0" border="1">
		    <tr>
		     <td valign="middle" class="alt1">
	             <img align="left" src="http://linux.unix.com/images/icons/goldstar.png">
		     </td>
		     <td class="alt2">
		     <font color="#2B4782">Please use next time <a href="http://www.unix.com/how-post-unix-linux-forums/167686-forum-video-tutorial-how-use-code-tags.html" target="_blank">code tags</a> for your code and data</font>
		     </td>
		     </tr>
                </table>
                </td>    
	</tr>
</table></div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>gvolpini</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186713-send-correct-exit-code-child-script-back-parent.html</guid>
		</item>
		<item>
			<title>delete ftp accounts created in cpanel</title>
			<link>http://www.unix.com/shell-programming-scripting/186711-delete-ftp-accounts-created-cpanel.html</link>
			<pubDate>Wed, 16 May 2012 13:28:42 GMT</pubDate>
			<description><![CDATA[i want to delete the extra ftp accounts that are created in cpanel 
e.g., when you go to cpanel->ftp accounts, any that are not there by default 
 
how can i do this via commandline? 
 
i am looping through the users on the server 
where is this info stored? 
 
 
also - how can the password of an...]]></description>
			<content:encoded><![CDATA[<div>i want to delete the extra ftp accounts that are created in cpanel<br />
e.g., when you go to cpanel-&gt;ftp accounts, any that are not there by default<br />
<br />
how can i do this via commandline?<br />
<br />
i am looping through the users on the server<br />
where is this info stored?<br />
<br />
<br />
also - how can the password of an ftp account be set via the command line?<br />
thanks</div>

]]></content:encoded>
			<category domain="http://www.unix.com/shell-programming-scripting/">Shell Programming and Scripting</category>
			<dc:creator>vanessafan99</dc:creator>
			<guid isPermaLink="true">http://www.unix.com/shell-programming-scripting/186711-delete-ftp-accounts-created-cpanel.html</guid>
		</item>
	</channel>
</rss>

