<?xml version="1.0" encoding="utf-8"?>

<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>DaniWeb IT Discussion Community - Shell Scripting</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our Shell Scripting forum is the place for Q&A-style discussions related to *nix shell scripting languages such as bash. Note that we also have a separate Perl forum within the Software Development category.]]></description>
		<language>en-US</language>
		<lastBuildDate>Sun, 08 Nov 2009 02:07:49 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - Shell Scripting</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>automation scripts--help needed urgent</title>
			<link>http://www.daniweb.com/forums/thread236736.html</link>
			<pubDate>Sat, 07 Nov 2009 08:53:36 GMT</pubDate>
			<description>Hi team, 
 
Well i have been asked to make use of automation  scripts for my host production box.. .And i hope u will help me with the same. 
 
#script as below: 
a)when i run  script it should ask the person to key in..(means should be interactive) 
b) it should search a file  
c) it should...</description>
			<content:encoded><![CDATA[<div>Hi team,<br />
<br />
Well i have been asked to make use of automation  scripts for my host production box.. .And i hope u will help me with the same.<br />
<br />
#script as below:<br />
a)when i run  script it should ask the person to key in..(means should be interactive)<br />
b) it should search a file <br />
c) it should replace a word/ multiple word in a file and prompt user for more changes once he done with<br />
and finally..<br />
D) delete the line rows... (any rows- mentioned by the user on files)<br />
<br />
I am done with the 1st script but i am having probs with the second and third<br />
<br />
2)I knw sed will replace <br />
 <pre style="margin:20px; line-height:13px"> sed 's/(word)/(with-word)'/ file name</pre><br />
3)and sed 'line,lined' file<br />
<br />
but how to use in the below script and ask the user for more inputs..<br />
Please provide me with the earliest.. <br />
thankin you once again<br />
<br />
PS: Moderator pls dont treat this mail as repetative <br />
<br />
regards<br />
whizkidash<br />
<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">vi showme.sh(script name)<br />
<br />
echo &quot;type the file to be search&quot;<br />
&nbsp;read fname<br />
if ls -lart | $fname<br />
then <br />
echo &quot; File exist&quot;<br />
else echo &quot; File fail&quot;<br />
------(uptil here it run fine)<br />
echo &quot; type the file to be replace/or substituted&quot;<br />
read tname</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>whizkidash</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236736.html</guid>
		</item>
		<item>
			<title>reading input problem.</title>
			<link>http://www.daniweb.com/forums/thread236480.html</link>
			<pubDate>Fri, 06 Nov 2009 05:10:17 GMT</pubDate>
			<description><![CDATA[The problem I'm having is that I want to read in whether the user wants to keep the spelling or change it, but the "read spelling" pulls from the 'line' and not from user input. 
 
my assignment description is as follows. 
 
 
Write a shell script that implements an interactive spell checker. The...]]></description>
			<content:encoded><![CDATA[<div>The problem I'm having is that I want to read in whether the user wants to keep the spelling or change it, but the &quot;read spelling&quot; pulls from the 'line' and not from user input.<br />
<br />
my assignment description is as follows.<br />
<br />
<br />
Write a shell script that implements an interactive spell checker. The general format for invocation is:<br />
<br />
    wordspell file <br />
<br />
where &quot;wordspell&quot; is the name of the executable file that contains your shell script, and &quot;file&quot; refers to the file to be checked word-by-word for spelling.<br />
<br />
Your are encouraged to take advantage of the &quot;ispell -l&quot; command. It produces a list of misspelled words from standard input.<br />
Specification:<br />
wordspell reads &quot;file&quot; and checks it for spelling of the words it contains. wordspell is invoked interactively. For each word that is found to be incorrect, the invoker is asked for either:<br />
<br />
    * to insist on the spelling of the word.<br />
    * to provide a replacement spelling <br />
<br />
If the invoker insists on the spelling of the word, then this word is added to wordspell's &quot;memory&quot;. wordspell remembers words in the file &quot;memory&quot; in the invoker's home directory. Any further invocation of wordspell by the same invoker will consider the word to be correct.<br />
<br />
Otherwise the invoker is prompted for a replacement spelling. As output, wordspell produces a 2-column-ed list of words, the left column lists incorrectly spelled words, the right column lists their replacement as given by the invoker. The list is produced after the invoker has answered to all incorrectly spelled words. <br />
<br />
 <pre style="margin:20px; line-height:13px">#! /bin/bash<br />
<br />
touch memory<br />
touch tempword<br />
ispell -l &lt; &quot;$1&quot; |<br />
while read line<br />
do<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;$line is mispelled. Press &quot;'Enter'&quot; to keep this spelling, or type a correction here:&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; read spelling<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if [$spelling = &quot;&quot;]; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $line &gt;&gt; memory&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo $spelling &gt;&gt; tempword<br />
&nbsp; &nbsp; &nbsp; &nbsp; fi<br />
done<br />
<br />
paste memory tempword &gt; allfile<br />
#echo $allfile</pre><br />
Any help would be appreciated. thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>railmaster7</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236480.html</guid>
		</item>
		<item>
			<title>Problem printing date</title>
			<link>http://www.daniweb.com/forums/thread236453.html</link>
			<pubDate>Fri, 06 Nov 2009 02:58:15 GMT</pubDate>
			<description><![CDATA[I have declared a variable: 
today=$(date +%m/%d/%Y) 
and I am trying to use sed to replace the word "in" with "out:date:name" but don't know the correct syntax to make $today print correctly. I have tried quotes and double quotes and brackets but to no avail.  When I do it like this, $name prints...]]></description>
			<content:encoded><![CDATA[<div>I have declared a variable:<br />
 <pre style="margin:20px; line-height:13px">today=$(date +%m/%d/%Y)</pre><br />
and I am trying to use sed to replace the word &quot;in&quot; with &quot;out:date:name&quot; but don't know the correct syntax to make $today print correctly. I have tried quotes and double quotes and brackets but to no avail.  When I do it like this, $name prints correctly, but $today prints literally &quot;$today&quot;<br />
 <pre style="margin:20px; line-height:13px">sed 's/\&lt;in\&gt;/out:'$today':'$name'/'</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Mattpd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236453.html</guid>
		</item>
		<item>
			<title>OMG... simple question driving me nuts</title>
			<link>http://www.daniweb.com/forums/thread236409.html</link>
			<pubDate>Thu, 05 Nov 2009 23:13:02 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
Just trying to do a simple shell script to generate a query line... can someone tell me why this does not work? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680"...]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
Just trying to do a simple shell script to generate a query line... can someone tell me why this does not work?<br />
<br />
 <pre style="margin:20px; line-height:13px">for e in `cat file.txt`; do echo INSERT INTO \`omstest_omstest\`.\`GEN2_FIELD\` VALUES \(NULL, \'$e\', \'$e\', \'4\', \'2009-10-05 00:00:00\', \'0\' \'0\'\)\;; done;</pre><br />
if you take out the $ before each of the e's, I get exactly what I am looking for... except of course there is an e where I want the variable to be.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Hilliard</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236409.html</guid>
		</item>
		<item>
			<title>How could I grep a line of text, and delete certian fields?</title>
			<link>http://www.daniweb.com/forums/thread236376.html</link>
			<pubDate>Thu, 05 Nov 2009 20:50:43 GMT</pubDate>
			<description>I need to grep a line from a text file, and delete the fourth and fifth field. then save it back to the text file. If that wont work I could also grep the line, and delete the first number and everything after it on that line. Both would accomplish my goal. Forgive me, I am a little newbish, but...</description>
			<content:encoded><![CDATA[<div>I need to grep a line from a text file, and delete the fourth and fifth field. then save it back to the text file. If that wont work I could also grep the line, and delete the first number and everything after it on that line. Both would accomplish my goal. Forgive me, I am a little newbish, but can anyone help?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Mattpd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236376.html</guid>
		</item>
		<item>
			<title><![CDATA[Shell script to append text file with today's date.]]></title>
			<link>http://www.daniweb.com/forums/thread236351.html</link>
			<pubDate>Thu, 05 Nov 2009 19:03:38 GMT</pubDate>
			<description><![CDATA[Hello all. 
 
New here. Another student looking for a little help.  Technically I wouldn't consider this a homework question, as it is part of a much larger project for my class.  My professor is little help so I'm here now. I hope you can help. 
 
I have a text file, and I need to print today's...]]></description>
			<content:encoded><![CDATA[<div>Hello all.<br />
<br />
New here. Another student looking for a little help.  Technically I wouldn't consider this a homework question, as it is part of a much larger project for my class.  My professor is little help so I'm here now. I hope you can help.<br />
<br />
I have a text file, and I need to print today's date<span style="font-weight:bold"> at the end of the last line</span> and in <span style="font-weight:bold">MM/DD/YYYY</span> format.<br />
<br />
What is in bold is what I have trouble with.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Mattpd</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236351.html</guid>
		</item>
		<item>
			<title>how to move files and check the completion.</title>
			<link>http://www.daniweb.com/forums/thread236325.html</link>
			<pubDate>Thu, 05 Nov 2009 17:14:15 GMT</pubDate>
			<description><![CDATA[Hi, 
 
We are taking backups for ldap instances, and with the new requirement would like to keep 1 day's of backup to local disk (/export1) and rest 14 days backup to SAN (/export2). Now we are in kind of fix on how to move the backups ( includes files & folders) to SAN and check if the move has...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
We are taking backups for ldap instances, and with the new requirement would like to keep 1 day's of backup to local disk (/export1) and rest 14 days backup to SAN (/export2). Now we are in kind of fix on how to move the backups ( includes files &amp; folders) to SAN and check if the move has been completed. We use the following subroutine for this. Is there any way we can check the moved backups, i mean in terms of size. Just in order in avoid a kind of situation where we have moved the backup and the size differs.<br />
<br />
We would like to update the script to following things: <br />
<br />
- Delete backups older than 15 days in /export2.<br />
- Move previous day's backup from /export1 to /export2.<br />
- check move completed successfully on /export2.<br />
- Take backup of /export1.<br />
<br />
<br />
P.S : This is not the complete script so please ignore variables. Also, i am only need commands and not a different script.<br />
<br />
 <pre style="margin:20px; line-height:13px">deletionandbackup2()<br />
&nbsp;{<br />
# Remove all old back up greater than retention period<br />
&nbsp;find $BACKUPDIR/$1 -type f -mtime +$RETENTION_PERIOD -name &quot;$1-*.ldif&quot; -exec rm -f \{\} \;<br />
# Backup ldap<br />
&nbsp;$BASEDIR/$1/db2ldif -a $BACKUPDIR/$1/$1-$DATE.ldif -n $2 -n $3<br />
&nbsp;$sleep_backup<br />
}</pre><br />
Thanks in Advance.<br />
<br />
Prince</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>john_prince</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236325.html</guid>
		</item>
		<item>
			<title>beneficial</title>
			<link>http://www.daniweb.com/forums/thread236051.html</link>
			<pubDate>Wed, 04 Nov 2009 20:19:14 GMT</pubDate>
			<description>SEO legend Aaron Wall’s new SEO Toolbar could replace expensive software for many web developers. Well, not for seasoned SEO professionals, no! But for the DIY webmaster unable to afford professional SEO, or the webmaster who does employ an SEO and simply wants to proof what he’s being sold,...</description>
			<content:encoded><![CDATA[<div>SEO legend Aaron Wall’s new SEO Toolbar could replace expensive software for many web developers. Well, not for seasoned SEO professionals, no! But for the DIY webmaster unable to afford professional SEO, or the webmaster who does employ an SEO and simply wants to proof what he’s being sold, definitely.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>rocky67</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236051.html</guid>
		</item>
		<item>
			<title>how to remove junk character</title>
			<link>http://www.daniweb.com/forums/thread235962.html</link>
			<pubDate>Wed, 04 Nov 2009 12:53:21 GMT</pubDate>
			<description>Hi Team, 
 
I am new to shell script. 
Do kindly help me remove junk character from a file having a million records.. As it is production setup do kindly advice 
 
Thanks ... 
Whizkidash</description>
			<content:encoded><![CDATA[<div>Hi Team,<br />
<br />
I am new to shell script.<br />
Do kindly help me remove junk character from a file having a million records.. As it is production setup do kindly advice<br />
<br />
Thanks ...<br />
Whizkidash</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>whizkidash</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235962.html</guid>
		</item>
		<item>
			<title>how to enter for the prompt?</title>
			<link>http://www.daniweb.com/forums/thread235712.html</link>
			<pubDate>Tue, 03 Nov 2009 17:54:35 GMT</pubDate>
			<description><![CDATA[hi,  
   basically i am trying to write a quick script to remote copy something as follow.  
 
"" scp user@192.168.1.5:/var/tmp/file.txt /var/tmp/newfile.txt "" 
 
if i do above cmd on the shell, i will be asked for password:  
 
my question is, how i do automate the password part within the shell...]]></description>
			<content:encoded><![CDATA[<div>hi, <br />
   basically i am trying to write a quick script to remote copy something as follow. <br />
<br />
&quot;&quot; scp <a href="mailto:user@192.168.1.5:/var/tmp/file.txt">user@192.168.1.5:/var/tmp/file.txt</a> /var/tmp/newfile.txt &quot;&quot;<br />
<br />
if i do above cmd on the shell, i will be asked for password: <br />
<br />
my question is, how i do automate the password part within the shell script to make it just copy without prompting for the password. <br />
<br />
<br />
thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>k2k</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235712.html</guid>
		</item>
		<item>
			<title>Uix Script Help Need</title>
			<link>http://www.daniweb.com/forums/thread235683.html</link>
			<pubDate>Tue, 03 Nov 2009 15:24:25 GMT</pubDate>
			<description><![CDATA[Can anybody help me with a unix script project that I have no clue on starting it, and also I 'm not that much familiar with unix scripting. Don't get me wrong have little bit experience with Linux, but when comes to script I'm just a beginner. If any someone can assist me with project that would...]]></description>
			<content:encoded><![CDATA[<div>Can anybody help me with a unix script project that I have no clue on starting it, and also I 'm not that much familiar with unix scripting. Don't get me wrong have little bit experience with Linux, but when comes to script I'm just a beginner. If any someone can assist me with project that would be great. At the bottom is the description of the project:<br />
<br />
PROJECT 3<br />
<br />
Create your own shell that will allow you to change file status and copy from one directory to another.<br />
<br />
<br />
If someone can help with this project.<br />
<br />
Thanks<br />
Deven<br />
<br />
<br />
The menu structure I mentioned can be created with the following template: <pre style="margin:20px; line-height:13px">echo &quot;Please choose a folder or file. If you choose a folder you will move into that folder. Enter nothing to exit.&quot;<br />
<br />
read choice<br />
<br />
if [ &quot;$choice&quot; != &quot;&quot; ]; then<br />
<br />
if [ -f $choice ]; then<br />
<br />
echo &quot;$choice options:&quot;<br />
echo &quot;Type hide to hide file.&quot;<br />
echo &quot;Type copypro to copy protect.&quot;<br />
echo &quot;Type read to set ready only.&quot;<br />
echo &quot;Type copy to copy a file from one directory to another.&quot;<br />
echo &quot;Type exit to choose a different file.&quot;<br />
read op<br />
<br />
case &quot;$op&quot; in<br />
<br />
hide)<br />
# code for hide<br />
copy)<br />
# code for copy<br />
copypro)<br />
# code for copypro<br />
read)<br />
# code for read<br />
exit)<br />
# code for exit<br />
*)<br />
# code for error<br />
esac<br />
else<br />
cd $choice<br />
fi<br />
<br />
fi</pre><br />
<br />
But there are many other possible implementations for reaching the solution.<br />
Also more comments for Project 3:<br />
<br />
Yes, file status means permissions enable/disable.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>deven1974</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235683.html</guid>
		</item>
		<item>
			<title>I need help with the cut command.</title>
			<link>http://www.daniweb.com/forums/thread235484.html</link>
			<pubDate>Mon, 02 Nov 2009 22:01:33 GMT</pubDate>
			<description><![CDATA[Hi everyone, 
 
In part of my script, I'm trying cut out couple of columns from the df -h command. 
 
The ones I want is the Filesystem column and the Mounted On column. This is what I have so far. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi everyone,<br />
<br />
In part of my script, I'm trying cut out couple of columns from the df -h command.<br />
<br />
The ones I want is the Filesystem column and the Mounted On column. This is what I have so far.<br />
<br />
 <pre style="margin:20px; line-height:13px">df -h | cut -d &quot; &quot; -f1</pre><br />
And that will get the Filesystem in the first field, but for the next column, I tried different fields and I still keep getting a  blank space.<br />
<br />
Any help you guys can give will be greatly appreciated! <br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Impact4ever</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread235484.html</guid>
		</item>
		<item>
			<title>Counter</title>
			<link>http://www.daniweb.com/forums/thread232932.html</link>
			<pubDate>Sat, 24 Oct 2009 14:15:35 GMT</pubDate>
			<description><![CDATA[Hi there, I have a unsolved problem here...my scripting do not go as I want, actually I want it to be solving the password in 10 seconds, but my scripting is run the timer and then only run the password solving.... anyone got any idea how to combine it?? 
 
  <div class="codeblock"> <div...]]></description>
			<content:encoded><![CDATA[<div>Hi there, I have a unsolved problem here...my scripting do not go as I want, actually I want it to be solving the password in 10 seconds, but my scripting is run the timer and then only run the password solving.... anyone got any idea how to combine it??<br />
<br />
 <pre style="margin:20px; line-height:13px">#!/bin/bash<br />
function timer<br />
{<br />
local OLD_IFS=&quot;${IFS}&quot;<br />
IFS=&quot;:&quot;<br />
local ARR=( $1 )<br />
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))<br />
local START=$(date +%s)<br />
local END=$((START + SECONDS))<br />
local CUR=$START<br />
<br />
while [[ $CUR -lt $END ]]<br />
do<br />
CUR=$(date +%s)<br />
LEFT=$((END-CUR))<br />
<br />
printf &quot;\r%02d:%02d:%02d&quot; \<br />
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))<br />
<br />
sleep 1<br />
done<br />
IFS=&quot;${OLD_IFS}&quot;<br />
echo &quot; &quot;<br />
}<br />
<br />
timer &quot;00:00:10&quot;<br />
time=30<br />
tries=3<br />
start=$(date +%s)<br />
left=$time<br />
while true<br />
do<br />
left=$(($time-$(date +%s)+start))<br />
read -t $left -p &quot;Code: &quot; code<br />
((tries--))<br />
if [[ &quot;$code&quot; == &quot;1234567890&quot; ]]; then <br />
echo &quot;CORRECT!!! Game Deactivated&quot;<br />
break<br />
else<br />
if (( $left&lt;=0 || $tries==0 ));then<br />
echo &quot;Game Activated!!!&quot;<br />
break<br />
fi<br />
echo &quot;WRONG!!! Please Try Again... There are $left seconds and $tries left.&quot;<br />
fi<br />
done<br />
exit</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>danialit</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232932.html</guid>
		</item>
		<item>
			<title>Awk Problems</title>
			<link>http://www.daniweb.com/forums/thread232759.html</link>
			<pubDate>Sat, 24 Oct 2009 01:54:40 GMT</pubDate>
			<description><![CDATA[Alright I admit, I hate AWK. Heck even my C++ class is making more sense at the moment. I have a strong suspicion that this is a language I will learn and never use again after this class, as everything else seems better/more intuitive. But maybe that's just me. 
 
I'm supposed to be reading from a...]]></description>
			<content:encoded><![CDATA[<div>Alright I admit, I hate AWK. Heck even my C++ class is making more sense at the moment. I have a strong suspicion that this is a language I will learn and never use again after this class, as everything else seems better/more intuitive. But maybe that's just me.<br />
<br />
I'm supposed to be reading from a data file like this.<br />
Brook,S,0,40,2,15<br />
Shields,M,1,35,0,10<br />
Smith,s,10,40,0.5,20<br />
<br />
And output the data into a table like this<br />
Name Gross Pay State Tax Fed Tax Total Tax Net Pay<br />
Brook 645.00 64.50 96.75 161.25 483.75<br />
Shields 350.00 17.50 31.50 49.00 301.00<br />
Smith 815.00 0.00 40.75 40.75 774.25<br />
Total 1810.00 82.00 169.00 251.00 1559.00<br />
<br />
First field in the input file is name, then marital status, then regular hours worked, overtime hours worked, finally pay.<br />
<br />
Specific calculations are irrelevant. My problem is not understanding awk.<br />
My code is the following:<br />
 <pre style="margin:20px; line-height:13px">BEGIN {<br />
printf(&quot;%s \t %s \t %s \t %s \t %s \t %s \n&quot;, &quot;Name&quot;, &quot;Gross Pay&quot;, &quot;State Tax&quot;, &quot;Fed Tax&quot;, &quot;Total Tax&quot;, &quot;Net Pay&quot;);<br />
}<br />
<br />
$1 !~/^#/ {<br />
grossPay = $4*$6;<br />
grossPay += $5*$6*1.5;<br />
<br />
if($2 == S) fedTaxRate = .15;<br />
if($2 == M) fedTaxRate = .10;<br />
<br />
if($3 == 0) stateTaxRate = .10;<br />
if($3 &gt; 0 &amp;&amp; $3 &lt;6) stateTaxRate = .05;<br />
if($3 &gt; 5 &amp;&amp; $3 &lt;10) stateTaxRate = .025;<br />
if($3 == 10) stateTaxRate = 0;<br />
<br />
totalTaxRate = 1 - fedTaxRate - stateTaxRate;<br />
totalTax = totalTaxRate * grossPay;<br />
stateTax = stateTaxRate * grossPay;<br />
fedTax = fedTaxRate * grossPay;<br />
netPay = grossPay - totalTax;<br />
<br />
printf(&quot;%s \t %d \t %d \t %d \t %d \t %d \n&quot;, $1, grossPay, stateTax, fedTax, totalTax, netPay);<br />
}<br />
<br />
END {<br />
<br />
}</pre>I admit I have absolutely no clue what $1 !~/^#/ { does, I found it online and put it in since before that I was getting syntax errors everywhere. Right now if I run this as it is instead of printing out the data, $1 prints out the whole input line and then every numeric variable is a 0.<br />
<br />
Any help understanding where I went wrong, and what I need to do?<br />
Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Gerbilkit</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232759.html</guid>
		</item>
		<item>
			<title>Need Filesystem Maintenance Script</title>
			<link>http://www.daniweb.com/forums/thread232643.html</link>
			<pubDate>Fri, 23 Oct 2009 15:30:00 GMT</pubDate>
			<description>Hi, I am not really good at shell scripting. I usually cut and paste from other scripts and customize it to do what I need. I am running Oracle 10g on AIX 5.3 machine and I need a script that does monitors a filesystem, I would say at least every hour by cron, and if the filesystem hits above 80%...</description>
			<content:encoded><![CDATA[<div>Hi, I am not really good at shell scripting. I usually cut and paste from other scripts and customize it to do what I need. I am running Oracle 10g on AIX 5.3 machine and I need a script that does monitors a filesystem, I would say at least every hour by cron, and if the filesystem hits above 80% full then I want the script to start deleting the oldest files in the filesystem first until the filesystem is back down to 50% full.<br />
<br />
I have scripts that monitor the filesystem, but the whole 80 to 50% thing is where I am stumped. I know if I spent the next few days studying I could figure it out, but I need this script today really for the customer. Anyone able to assist me? I would really appreciate it. Thanks.<br />
<br />
Jim</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>nibbsbitt</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232643.html</guid>
		</item>
		<item>
			<title>Toch</title>
			<link>http://www.daniweb.com/forums/thread232043.html</link>
			<pubDate>Wed, 21 Oct 2009 17:31:37 GMT</pubDate>
			<description><![CDATA[I just joined and I am new to scripting. Please can some one help me to put links to a file that has been already sorted. code below.  
grep -i $1 *html */*html | sed -e 's|<|.|g' -e 's|>|.|g' | sort | uniq -u >>output_file 
 
I need to put links to the results so that when clicked the out put will...]]></description>
			<content:encoded><![CDATA[<div>I just joined and I am new to scripting. Please can some one help me to put links to a file that has been already sorted. code below. <br />
grep -i $1 *html */*html | sed -e 's|&lt;|.|g' -e 's|&gt;|.|g' | sort | uniq -u &gt;&gt;output_file<br />
<br />
I need to put links to the results so that when clicked the out put will link to the original file<br />
<br />
butler/act5.html[/U]:.p class=&quot;speech&quot;.Alas, poor Yorick! I knew him, Horatio: a<br />
<br />
Thanks for your help.<br />
Toch</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>tochukwu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread232043.html</guid>
		</item>
		<item>
			<title>Shell script to read lines in a text file and filter user data</title>
			<link>http://www.daniweb.com/forums/thread231920.html</link>
			<pubDate>Wed, 21 Oct 2009 09:41:42 GMT</pubDate>
			<description><![CDATA[hi all, 
 
I have this file [myfile.txt] with some user data. 
 
example: 
$cat myfile.txt 
FName|LName|Gender|Company|Branch|Bday|Salary|Age 
aaaa|bbbb|male|cccc|dddd|19900814|15000|20| 
eeee|asdg|male|gggg|ksgu|19911216||| 
aara|bdbm|male|kkkk|acke|19931018||23|]]></description>
			<content:encoded><![CDATA[<div>hi all,<br />
<br />
I have this file [myfile.txt] with some user data.<br />
<br />
example:<br />
$cat myfile.txt<br />
FName|LName|Gender|Company|Branch|Bday|Salary|Age<br />
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|<br />
eeee|asdg|male|gggg|ksgu|19911216|||<br />
aara|bdbm|male|kkkk|acke|19931018||23|<br />
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|<br />
aera|bprb|male|cccc|pppp||15000|20|<br />
.<br />
.<br />
. // and so on<br />
<br />
<br />
So what I want to do is to take out (to a file) the missing fields as following format:<br />
<br />
&lt;FName&gt; &lt;LName&gt; &lt;Company&gt; Missing Field/s:&lt;&gt; &lt;&gt;<br />
<br />
example output:<br />
<br />
eeee asdg gggg Missing Field/s: Salary Age<br />
aara bdbm kkkk Missing Field/s: Salary<br />
<br />
<span style="color:Red">CAN ANYONE HELP ME PLEASE !!!!!!!!!!!!!!!</span></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>e04047</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread231920.html</guid>
		</item>
		<item>
			<title>Problem using sed</title>
			<link>http://www.daniweb.com/forums/thread231072.html</link>
			<pubDate>Sun, 18 Oct 2009 00:34:22 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I am trying to replace the old_string with the new_string using sed. 
But i am unable to do it using the following script. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am trying to replace the old_string with the new_string using sed.<br />
But i am unable to do it using the following script.<br />
<br />
 <pre style="margin:20px; line-height:13px">#!/bin/sh<br />
<br />
old_string=&quot;p cnf 10 20&quot;<br />
new_string=&quot;p cnf 98 99&quot;<br />
<br />
sed -e 's/old_string/new_string/' file1.txt &gt; file2.txt</pre><br />
Contents of file1.txt<br />
 <pre style="margin:20px; line-height:13px">p cnf 10 20<br />
1 2 3<br />
4 5 6<br />
8 9 10<br />
11 12 30</pre><br />
Any help is appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>guest7</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread231072.html</guid>
		</item>
		<item>
			<title>perform file actions located in another direcory</title>
			<link>http://www.daniweb.com/forums/thread229272.html</link>
			<pubDate>Sun, 11 Oct 2009 09:36:12 GMT</pubDate>
			<description>hai dani, 
 
i have a problem with listing the contents of file in another directory. 
 
my default path is in /home/pallu  
where my file called DirProg script exists , now i want to find any file which starts with a or A in a dir and store the content in another file called output.dat. 
 
im not...</description>
			<content:encoded><![CDATA[<div>hai dani,<br />
<br />
i have a problem with listing the contents of file in another directory.<br />
<br />
my default path is in /home/pallu <br />
where my file called DirProg script exists , now i want to find any file which starts with a or A in a dir and store the content in another file called output.dat.<br />
<br />
im not able to dispaly file in the directory threw script.<br />
<br />
my code is below:----<br />
<br />
<br />
echo &quot;Enter a directory name&quot;<br />
read dname<br />
<br />
if test -d $dname<br />
then<br />
<br />
	if grep -c ^A dirlist1<br />
	then<br />
	       fname=`grep ^A dirlist1`<br />
		cat $fname|cat &gt; output.dat<br />
		echo &quot;Content of file is written in a file called output.dat&quot; <br />
	fi<br />
<br />
	<br />
<br />
else<br />
	echo &quot;The entered name is not a directory&quot;<br />
fi<br />
<br />
<br />
<br />
thanks in advance.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>karpaklu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread229272.html</guid>
		</item>
		<item>
			<title>Getting script to run on boot up in linux</title>
			<link>http://www.daniweb.com/forums/thread229117.html</link>
			<pubDate>Sat, 10 Oct 2009 12:58:26 GMT</pubDate>
			<description><![CDATA[Hi guys, 
 
I've come to a road block so i need some help. 
 
1)I have an exe which i need to run at start up. 
 
So I put the following bash file in the inid.d directory: 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
<br />
I've come to a road block so i need some help.<br />
<br />
1)I have an exe which i need to run at start up.<br />
<br />
So I put the following bash file in the inid.d directory:<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">#!/bin/bash<br />
#<br />
#<br />
<br />
. /etc/rc.d/init.d/functions<br />
<br />
EXE_DIR=&quot;/root/monkey-0.9.2/bin/&quot;<br />
EXE_NAME=&quot;monkey&quot;<br />
<br />
<br />
#############################################################<br />
#################### Functions ##############################<br />
#############################################################<br />
<br />
function start {<br />
&nbsp; &nbsp; RUNNING=`ps -ef | grep -c ./${EXE_NAME}\$`<br />
&nbsp; &nbsp; if [ $RUNNING -ge 1 ]; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;${EXE_NAME} is already running&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo_failure<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; if [ ! -x &quot;${EXE_DIR}${EXE_NAME}&quot; ]; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo&nbsp; &quot;[error] ${EXE_NAME} doesn't exist&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo_failure<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cd &quot;${EXE_DIR}&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sleep 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ./${EXE_NAME} &gt; output &amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; disown<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo&nbsp; &quot;Restarting ${EXE_NAME}&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo_ok<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; fi<br />
&nbsp; &nbsp; fi<br />
}<br />
<br />
function stop {<br />
&nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; echo &quot;Stopping ${EXE_NAME}&quot;<br />
&nbsp; &nbsp; RUNNING=`ps -ef | grep -c ./${EXE_NAME}\$`<br />
&nbsp; &nbsp; if [ $RUNNING -ge 1 ]; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; ID=`ps -ef | grep ${EXE_NAME} | grep -v grep | awk '{print $2}'`<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;PID= $ID&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; kill -9 $ID<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo_ok<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo&nbsp; &quot;${EXE_NAME} is not running&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo_failure<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; fi<br />
<br />
<br />
&nbsp; &nbsp; return 0;<br />
}<br />
<br />
function restart {<br />
&nbsp; &nbsp; &nbsp; &nbsp; stop<br />
&nbsp; &nbsp; &nbsp; &nbsp; start<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 1;<br />
}<br />
<br />
function status {<br />
&nbsp; &nbsp; RUNNING=`ps -ef | grep -c ./${EXE_NAME}\$`<br />
&nbsp; &nbsp; if [ $RUNNING -ge 1 ]; then<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo&nbsp; &quot;${EXE_NAME} Running&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo_ok<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; tail -f &quot;${EXE_DIR}output&quot;<br />
&nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;${EXE_NAME} Not Running&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo_failure<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&quot;<br />
&nbsp; &nbsp; fi<br />
}<br />
<br />
#############################################################<br />
###################### MAIN #################################<br />
#############################################################<br />
<br />
<br />
case &quot;$1&quot; in<br />
&nbsp; &nbsp; &nbsp; &nbsp; start)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; start<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; stop)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stop<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; restart)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; restart<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; details|status)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; status<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; *)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; exit 1<br />
esac<br />
<br />
exit 0</pre><br />
The funny thing is the pid says it is running on boot. But it only works when I log on and restart the program manually?!<br />
<br />
Any ideas?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>iamthwee</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread229117.html</guid>
		</item>
		<item>
			<title>This is the error i get when i run my script: Unmatched `</title>
			<link>http://www.daniweb.com/forums/thread228764.html</link>
			<pubDate>Fri, 09 Oct 2009 05:35:42 GMT</pubDate>
			<description><![CDATA[Hi,  
can anyone please help me on this.  
I dont understand as to why am getting this error.. 
 
Please, please help on this! 
 
fortesting purpose I have commented certain lines.. 
 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi, <br />
can anyone please help me on this. <br />
I dont understand as to why am getting this error..<br />
<br />
Please, please help on this!<br />
<br />
fortesting purpose I have commented certain lines..<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">&quot;Pre_s2a_leadtime.sh&quot; 55 lines, 1233 characters<br />
#!/bin/csh<br />
<br />
# Check if program is already running and echo a time stamp for the log file<br />
#log_start_chk $0 $$<br />
#if ( $status == 0 ) then<br />
#exit<br />
#endif<br />
<br />
#source run_env<br />
<br />
set L2S_RUN_LOG_FILE=&quot;Pre_s2a_leadtime.log&quot;<br />
<br />
echo -n &quot;$0 started&quot; &gt;&gt; ${L2S_RUN_LOG_FILE}<br />
date '+%m%d%y %H:%M:%S' &gt;&gt;&nbsp; ${L2S_RUN_LOG_FILE}<br />
<br />
<br />
#setenv DB_NAME viewer/viewer@ltstprod<br />
<br />
<br />
FLAG=`sqlplus -silent viewer/viewer@ltstprod &lt;&lt; SQLEND &gt;&gt; ${L2S_RUN_LOG_FILE}<br />
set pagesize 0 feedback off verify off heading off echo off<br />
select UNCONSTRAINED_PIECE_PART from ICMPINPUTCONTROL;<br />
exit;<br />
SQLEND`<br />
<br />
if [ $FLAG ='Y']<br />
then<br />
<br />
sqlplus viewer/viewer@ltstprod &lt;&lt; sqlend &gt;&gt; ${L2S_RUN_LOG_FILE}<br />
# Running the following queries before the actual L2S program<br />
<br />
drop table cycle_time_bkp;<br />
<br />
create table cycle_time_bkp as select * from cycle_time;<br />
<br />
update cycle_time a set cycle_time_days = 0<br />
where exists(select 1 from route b where a.id = b.id and a.route = b.route and b.flow_id = 7);<br />
<br />
quit<br />
&quot;Pre_s2a_leadtime.sh&quot; 55 lines, 1256 characters</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>naziatarannum</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228764.html</guid>
		</item>
		<item>
			<title>Can somebody help with looping my command?</title>
			<link>http://www.daniweb.com/forums/thread228355.html</link>
			<pubDate>Wed, 07 Oct 2009 14:55:08 GMT</pubDate>
			<description><![CDATA[Hi, 
 
I am using a set of tools called FWTools which runs commands in the shell window. One command that I am using edits tif files by adding an overview to the file. The syntax is: 
 
gdaladdo -r average "D:\Map Files\Tiffs\ST00.TIF" 2 4 8 16 32  
 
What I need to do is run this command on 800...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am using a set of tools called FWTools which runs commands in the shell window. One command that I am using edits tif files by adding an overview to the file. The syntax is:<br />
<br />
gdaladdo -r average &quot;D:\Map Files\Tiffs\ST00.TIF&quot; 2 4 8 16 32 <br />
<br />
What I need to do is run this command on 800 files in the directory D:\Map Files\Tiffs - is this possible?<br />
<br />
I was thinking something like:<br />
<br />
for %x in (*.tif) do gdaladdo -r average %x 2 4 8 16 32 but am not getting very far.<br />
<br />
 Any help or advice is welcome.<br />
<br />
Regards<br />
<br />
JD</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>SoftwareMatters</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228355.html</guid>
		</item>
		<item>
			<title>Log file analysis based on time range</title>
			<link>http://www.daniweb.com/forums/thread228069.html</link>
			<pubDate>Tue, 06 Oct 2009 14:01:15 GMT</pubDate>
			<description><![CDATA[I am a beginner in shell programming in Unix. My current problem is log file analysis based on a given time range for listed dates. The file is a long file and I need to sort IPs based on a user input through terminal. For example, from the end of the logfile since it's sorted according to the date...]]></description>
			<content:encoded><![CDATA[<div>I am a beginner in shell programming in Unix. My current problem is log file analysis based on a given time range for listed dates. The file is a long file and I need to sort IPs based on a user input through terminal. For example, from the end of the logfile since it's sorted according to the date then I assume it should be converted e.g. the last date (date+%s) to timestamp and then subtract the value that user inserts by using switches -H(hours = h*3600 ) or -D(day = d*24*3600 ) and then compare by starting from the end of log file to reach the desired result. Any help on this as an example would be appreciated:<br />
<br />
Example: user inputs: -H 12<br />
last date in logfile = last row in logfile = 22 Oct 2002 21:02:33 +0200<br />
convert it by using: date -d &quot;22 Oct 2002 21:02:33 +0200&quot; +%s subtract using to timestamp <br />
timestamp - (12*3600) = X, means the date which is 12 hours later so you need all records from the end of logfile till this date.<br />
<br />
The format example of the log file for each line is as follows:<br />
172.16.0.3 - - [31/Mar/2002:19:30:41 +0200] &quot;GET / HTTP/1.1&quot; 200 123 &quot;&quot; &quot;Mozilla/5.0 (compatible; Konqueror/2.2.2-2; Linux)&quot;<br />
<br />
I’ have however managed to <span style="font-weight:bold">sort</span> and <span style="font-weight:bold">group</span> repeated IPs without giving any range using <span style="font-weight:bold">uniq</span> and <span style="font-weight:bold">sort</span> tools e.g.   <br />
<br />
 <pre style="margin:20px; line-height:13px">$ cut -f1 -d&quot; &quot; logfile | sort | uniq -c</pre>OUTPUT: <br />
8 12.153.20.132   <br />
2 172.16.0.3<br />
14 12.30.66.226   <br />
1 122.152.128.49<br />
<br />
, but based on date and user switches (like -H) is somewhat difficult to get over with. A code sample or weblink for further help to list IPs based on &quot;hours range input by user&quot; in shell would be of great help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>UniBoy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread228069.html</guid>
		</item>
		<item>
			<title>Help With Case Nesting(Restaurant Ordering Simulator)</title>
			<link>http://www.daniweb.com/forums/thread227791.html</link>
			<pubDate>Mon, 05 Oct 2009 12:44:12 GMT</pubDate>
			<description>I have a problem with the Nesting of case statements. 
This is a Simple restaurant program which simulates food ordering. 
I used Case statements to Display Multiple nested menus base on the users choice 
But i seem to have a problem with the esac,seems my nesting is wrong.Pleas any help or advice...</description>
			<content:encoded><![CDATA[<div>I have a problem with the Nesting of case statements.<br />
This is a Simple restaurant program which simulates food ordering.<br />
I used Case statements to Display Multiple nested menus base on the users choice<br />
But i seem to have a problem with the esac,seems my nesting is wrong.Pleas any help or advice will be appreciated.<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">#!/bin/bash<br />
<br />
&nbsp; clear<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # display menu<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp;  Superman Restaurant&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Main Menu&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp;  $(date)&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;1. Display Meal Menu.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;2. Display Drinks.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;3. Display Desert.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;4. Exit&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # get input from the user<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Enter your choice [ 1 -4 ] &quot; choice<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # make decision using case..in..esac<br />
&nbsp; &nbsp; &nbsp; &nbsp;  case $choice in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clear<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp;  Superman Restaurant&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Meal Menu&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;1. Chichen Fried Rice&nbsp; &nbsp; 10RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;2. Tom Yam Fried Rice&nbsp; &nbsp; 15RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;3. Lovers Rice&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  10RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;4. Curry Rice&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 12RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;5. Jelof Rice&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 15RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;6. Fairy Rice&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 10RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;7. Spicy Stew Rice&nbsp; &nbsp; &nbsp;  18RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;8. Exit&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Enter your choice [ 1 -7 ] &quot; Meal<br />
&nbsp; &nbsp; &nbsp; &nbsp;  case $Meal in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Chichen Fried Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  ;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Tom Yam Fried Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Lovers Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Curry Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  5)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Jelof Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  6)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Fairy Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  7)<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot; You Just Selected Spicy Rice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8)<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Bye!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Error: Invalid option...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] key to continue...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp;  <br />
esac<br />
<br />
&nbsp;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  2)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clear<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp;  Superman Restaurant&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Drinks Menu&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;1. Kikapo Juice&nbsp; &nbsp;  2RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;2. Orange Juice&nbsp; &nbsp;  3RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;3. Apple Juice&nbsp; &nbsp; &nbsp; 3RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;4. Lemon Ice Tea&nbsp; &nbsp; 1RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;5. Mango Lassi&nbsp; &nbsp; &nbsp; 5RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;6. Herba Tea&nbsp; &nbsp; &nbsp; &nbsp; 2RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;7. Cococola&nbsp; &nbsp; &nbsp; &nbsp;  2RM&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;8. Bye!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Enter your choice [ 1 -8 ] &quot; Drinks<br />
&nbsp; &nbsp; &nbsp; &nbsp;  case $Drinks in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  1)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Kikapo Juice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Orange Juice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  3)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Apple Juice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot; You Just Selected Lemon Juice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  5)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Mango Juice&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  6)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Herbal Tea&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  7)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Cocacola&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  8)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Bye!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Error: Invalid option...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] key to continue...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; esac<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3)<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; clear<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp;  Superman Restaurant&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Desert Menu&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;-------------------------------&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;1. Ferry Cake&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  15RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;2. Chocolate ice Cream&nbsp; &nbsp; &nbsp; 10RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;3. Vanilla Cake&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  13RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;4. Queen Cake&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  12RM.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;5. Bye!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Enter your choice [ 1 -5 ] &quot; Desert<br />
&nbsp; &nbsp; &nbsp; &nbsp;  case $Desert in<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  1)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Ferry Cake&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Chocolate ice Cream&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  3)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot; You Just Selected Vanilla Cake&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; echo &quot; You Just Selected Queen Cake&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] to continue order...&quot;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if $readEnterKey true<br />
&nbsp; &nbsp; &nbsp; &nbsp;  then<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Your Order has been Completed&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;&quot;<br />
&nbsp; &nbsp;  <br />
fi<br />
&nbsp; &nbsp; &nbsp; &nbsp;  5)<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;Bye!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Error: Invalid option...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] key to continue...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; esac<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Bye!&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  echo &quot;Error: Invalid option...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  read -p &quot;Press [Enter] key to continue...&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
<br />
<br />
<br />
esac</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>frankycool</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread227791.html</guid>
		</item>
		<item>
			<title>sed</title>
			<link>http://www.daniweb.com/forums/thread227601.html</link>
			<pubDate>Sun, 04 Oct 2009 16:37:37 GMT</pubDate>
			<description><![CDATA[What am I doing wrong? 
for filename in /home/darragh/public_html/test/* 
do 
 sed -i 's/..\/config/.\/config/g' 
done; 
It just gives me: sed: No input files]]></description>
			<content:encoded><![CDATA[<div>What am I doing wrong?<br />
 <pre style="margin:20px; line-height:13px">for filename in /home/darragh/public_html/test/*<br />
do<br />
&nbsp;sed -i 's/..\/config/.\/config/g'<br />
done;</pre><br />
It just gives me: sed: No input files</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Kruptein</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread227601.html</guid>
		</item>
		<item>
			<title>Changing a string in 1500 documents</title>
			<link>http://www.daniweb.com/forums/thread227574.html</link>
			<pubDate>Sun, 04 Oct 2009 13:30:28 GMT</pubDate>
			<description>Hello dear people, 
 
I have a bit of a problem, I need to change something and I am not sure how. 
 
I need to change  
 
(see: Codification) 
 
To look like.</description>
			<content:encoded><![CDATA[<div>Hello dear people,<br />
<br />
I have a bit of a problem, I need to change something and I am not sure how.<br />
<br />
I need to change <br />
<br />
(see: Codification)<br />
<br />
To look like.<br />
<br />
 [[Codification]] <br />
<br />
Of course the word codification can also look like<br />
<br />
(see: PrimaryLegislation)<br />
<br />
And then it needs to be<br />
<br />
[[Primary Legislation]] <br />
<br />
Can someone please write this little conversion for me? It is for MediaWiki (obviously)<br />
<br />
I can only do the first part I think<br />
<br />
:$/(see:/[[/g<br />
<br />
But that is about as far as I get,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>externalaw</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread227574.html</guid>
		</item>
		<item>
			<title>logarithmic expression how to calculate?? Please help</title>
			<link>http://www.daniweb.com/forums/thread227270.html</link>
			<pubDate>Fri, 02 Oct 2009 17:12:04 GMT</pubDate>
			<description><![CDATA[Hello, 
I'm new in shell scripting and i face some problems. 
I need your help to calculate a logarithmic expression in shell script 
for example i have 2 variables x1 x2 
$x1=3 
$x2=5 
$Result=`expr x2 * log2 x1`    ???? 
$echo "Result is $Result 
 
I know that this is wrong and i cant find any...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
I'm new in shell scripting and i face some problems.<br />
I need your help to calculate a logarithmic expression in shell script<br />
for example i have 2 variables x1 x2<br />
$x1=3<br />
$x2=5<br />
$Result=`expr x2 * log2 x1`    ????<br />
$echo &quot;Result is $Result<br />
<br />
I know that this is wrong and i cant find any solution.<br />
<br />
what I'm trying to do is to &quot;import&quot; the formula of entropy which is <br />
-Σ x1*log x1 for some values that i have . If someone knows please help me <br />
thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>draxmas</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread227270.html</guid>
		</item>
		<item>
			<title>Bomb timer and secret code in shell</title>
			<link>http://www.daniweb.com/forums/thread226974.html</link>
			<pubDate>Thu, 01 Oct 2009 09:17:24 GMT</pubDate>
			<description>Please I want to build a program in scripting that will start a timer from 60 seconds and decrement every second.There should be an input where the user should be able to enter the secret password to dis-activate the timer-bomb.If the user fails to enter the correct password 3 times or the timer...</description>
			<content:encoded><![CDATA[<div>Please I want to build a program in scripting that will start a timer from 60 seconds and decrement every second.There should be an input where the user should be able to enter the secret password to dis-activate the timer-bomb.If the user fails to enter the correct password 3 times or the timer reaches 0 without any entries,a message should be displayed as Bomb Exploded else a message should be displayed as Bomb Defused.Beneath is the code i tried but its not working as i wish,so please help me if necessary.<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
#!/bin/bash<br />
<br />
<br />
<br />
&nbsp; read -t 10 -p &quot;Code : &quot; code<br />
<br />
for (( i=1 ; i&lt;=3 ; i++ )); do echo $i;<br />
<br />
&nbsp; if [ &quot;$code&quot; == &quot;boom&quot; ]; <br />
<br />
&nbsp; then<br />
<br />
&nbsp; &nbsp; &nbsp;  echo &quot;Bomb Disactivated&quot;<br />
<br />
&nbsp; else<br />
<br />
&nbsp; &nbsp; &nbsp;  echo &quot;Bomb Exploded&quot;<br />
<br />
<br />
<br />
&nbsp; fi</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>frankycool</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread226974.html</guid>
		</item>
		<item>
			<title>adding a pattern after a particular line number</title>
			<link>http://www.daniweb.com/forums/thread226801.html</link>
			<pubDate>Wed, 30 Sep 2009 14:04:29 GMT</pubDate>
			<description>hi all 
 
i want to add a pattern (say XYZ) after variable $lineNum in some tempFile. 
How do i do this, preferably using sed ? 
 
for eg. 
Initially 
line 1  
line 2</description>
			<content:encoded><![CDATA[<div>hi all<br />
<br />
i want to add a pattern (say XYZ) after variable $lineNum in some tempFile.<br />
How do i do this, preferably using sed ?<br />
<br />
for eg.<br />
Initially<br />
line 1 <br />
line 2<br />
<br />
Later<br />
line1<br />
my pattern<br />
line2</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>kneiel</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread226801.html</guid>
		</item>
		<item>
			<title>A shell script that will simulate food ordering system in a restaurant</title>
			<link>http://www.daniweb.com/forums/thread226553.html</link>
			<pubDate>Tue, 29 Sep 2009 14:10:58 GMT</pubDate>
			<description>Please can i have the code of A shell script that will simulate food ordering system in a restaurant? Just a simple system will be helpful,i just want to learn and compare with other programming languages.Thanks</description>
			<content:encoded><![CDATA[<div>Please can i have the code of A shell script that will simulate food ordering system in a restaurant? Just a simple system will be helpful,i just want to learn and compare with other programming languages.Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>frankycool</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread226553.html</guid>
		</item>
		<item>
			<title>cat . causes strange characters</title>
			<link>http://www.daniweb.com/forums/thread225454.html</link>
			<pubDate>Thu, 24 Sep 2009 14:56:31 GMT</pubDate>
			<description>when i run cat . i displays some weird characters which is fine, but after that i can not turn back to my normal directory path. it always shows some weird characters in my directory path too. 
 
Why? how to turn back?</description>
			<content:encoded><![CDATA[<div>when i run cat . i displays some weird characters which is fine, but after that i can not turn back to my normal directory path. it always shows some weird characters in my directory path too.<br />
<br />
Why? how to turn back?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>serkan sendur</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225454.html</guid>
		</item>
		<item>
			<title>shell script required to get the mail</title>
			<link>http://www.daniweb.com/forums/thread225339.html</link>
			<pubDate>Thu, 24 Sep 2009 06:40:17 GMT</pubDate>
			<description>Hi, 
 
I have a FTP shell script  which is used to move the file from linux server to Windows FTP machine.Here my problem is some times because of  network problem the files are not moving to FTP .Here i want to get the mail weather the files are moved to ftp is success or not when the CRONTAB ...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I have a FTP shell script  which is used to move the file from linux server to Windows FTP machine.Here my problem is some times because of  network problem the files are not moving to FTP .Here i want to get the mail weather the files are moved to ftp is success or not when the CRONTAB  fires to move those file to FTP.Can any one please help . <br />
<br />
Here is my shell script<br />
<br />
 <pre style="margin:20px; line-height:13px">HOST='192.168.2.85'<br />
USER='dump'<br />
PASSWD='und08!'<br />
<br />
#FILE='*'<br />
<br />
#DT=$(date +%a_%h_%d_%Y)<br />
DT=$(date +%Y-%m-%d)<br />
<br />
ftp -n $HOST &gt; .ftpout.txt 2&gt;.ftperr.txt &lt;&lt;END_SCRIPT<br />
<br />
quote USER $USER<br />
quote PASS $PASSWD<br />
<br />
#lcd /home/oracle/test<br />
lcd /u03/ACADATAEXTRACT/<br />
<br />
cd qfund-datawarehouse<br />
mkdir $DT<br />
cd $DT<br />
<br />
prompt<br />
mput *<br />
quit<br />
<br />
END_SCRIPT<br />
exit 0</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>siddabathuni</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225339.html</guid>
		</item>
		<item>
			<title>directory renaming ... related</title>
			<link>http://www.daniweb.com/forums/thread225156.html</link>
			<pubDate>Wed, 23 Sep 2009 12:56:06 GMT</pubDate>
			<description><![CDATA[hi all, 
 
given a path, for example : 
/<pwd>/artist/album/ 
 
what i would like to do is to rename the album directory like that : 
/<pwd>/artist/artist | album/ 
 
and i would like to do the latter for all the "artist" directories 
and for all the "album" directories that belong to an artist]]></description>
			<content:encoded><![CDATA[<div>hi all,<br />
<br />
given a path, for example :<br />
/&lt;pwd&gt;/artist/album/<br />
<br />
what i would like to do is to rename the album directory like that :<br />
/&lt;pwd&gt;/artist/artist | album/<br />
<br />
and i would like to do the latter for all the &quot;artist&quot; directories<br />
and for all the &quot;album&quot; directories that belong to an artist<br />
<br />
i don t really want to mess my music directory, that s why i am asking for your help<br />
<br />
thanx</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>OneDreamCloser</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225156.html</guid>
		</item>
		<item>
			<title>writing variable contents to a specific line in a file</title>
			<link>http://www.daniweb.com/forums/thread225155.html</link>
			<pubDate>Wed, 23 Sep 2009 12:45:55 GMT</pubDate>
			<description>if line 5 of a file needs to be replaced with contents of $line, how could we possibly do this using sed ?</description>
			<content:encoded><![CDATA[<div>if line 5 of a file needs to be replaced with contents of $line, how could we possibly do this using sed ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>kneiel</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225155.html</guid>
		</item>
		<item>
			<title>sed substitution with variables</title>
			<link>http://www.daniweb.com/forums/thread225125.html</link>
			<pubDate>Wed, 23 Sep 2009 10:32:13 GMT</pubDate>
			<description><![CDATA[My input file looks like this 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div>...]]></description>
			<content:encoded><![CDATA[<div>My input file looks like this<br />
 <pre style="margin:20px; line-height:13px">abc def \<br />
ghi jkl &amp;&amp; mno || hju</pre><br />
My objective:<br />
to replace '\' with line 2<br />
<br />
newLine=`sed -n &quot;2 p&quot; inputFile`<br />
sed -n 's/\\/'&quot;$newLine&quot;'/p' inputFile | tee inputFile<br />
<br />
When i do this, the output i get is -&gt;<br />
<br />
abc def abc def  ghi jkl \\ mno || hju<br />
but the output should have been <br />
abc def abc def  ghi jkl &amp;&amp; mno || hju<br />
<br />
Why is it that '&amp;&amp;' gets replaced by '\\' ?<br />
Where could i be going wrong ?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>kneiel</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225125.html</guid>
		</item>
		<item>
			<title>find a paragraph in a file then delete it</title>
			<link>http://www.daniweb.com/forums/thread225110.html</link>
			<pubDate>Wed, 23 Sep 2009 09:14:03 GMT</pubDate>
			<description>Hi Guys, 
 
I have a file with lots of similar records example shown at end, I want to be able to delete one of the records and have the following line of code which finds the record I need to delete, my question is now I have found the record how do I delete it and keep the rest of the file...</description>
			<content:encoded><![CDATA[<div>Hi Guys,<br />
<br />
I have a file with lots of similar records example shown at end, I want to be able to delete one of the records and have the following line of code which finds the record I need to delete, my question is now I have found the record how do I delete it and keep the rest of the file intact.<br />
 <pre style="margin:20px; line-height:13px">awk '{ FS=&quot;\n&quot; ; RS=&quot;define&quot; } /STRING/ { print }' FILENAME<br />
e.g.<br />
awk '{ FS=&quot;\n&quot; ; RS=&quot;define&quot; } /check_chris/ { print }' xeno.cfg</pre>File<br />
 <pre style="margin:20px; line-height:13px">define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
notification_options c<br />
contact_groups&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unix<br />
use generic-service<br />
host_name xeno<br />
service_description Check dmesg for fails<br />
check_command check_nrpe!check_dmesg<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
notification_options c<br />
contact_groups&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unix<br />
use generic-service<br />
host_name xeno<br />
service_description Check Prtdiag<br />
check_command check_nrpe!check_prtdiag<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
notification_options c<br />
contact_groups&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unix<br />
use generic-service<br />
host_name xeno<br />
service_description Client Version<br />
check_command check_nrpe!check_uname<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
notification_options c<br />
notification_options c<br />
contact_groups&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unix<br />
use generic-service<br />
host_name xeno<br />
service_description DNS<br />
check_command check_nrpe!check_dns<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
notification_options c<br />
contact_groups&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unix<br />
use generic-service<br />
host_name xeno<br />
service_description Check NTP<br />
check_command check_nrpe!check_ntp<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
use generic-service<br />
host_name xeno<br />
service_description Check Memory<br />
check_command check_nrpe!check_mem<br />
notification_options n<br />
contact_groups unix<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
use generic-service<br />
host_name xeno<br />
service_description Check Swap<br />
check_command check_nrpe!check_swap<br />
notification_options n<br />
contact_groups unix<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
use generic-service<br />
host_name xeno<br />
service_description Load<br />
check_command check_nrpe!check_load<br />
notification_options n<br />
contact_groups unix<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
use generic-service<br />
host_name xeno<br />
service_description CPU<br />
check_command check_nrpe!check_cpu<br />
notification_options n<br />
contact_groups unix<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
use generic-service<br />
host_name xeno<br />
service_description Check IO Wait<br />
check_command check_nrpe!check_vmio<br />
notification_options n<br />
contact_groups unix<br />
}<br />
define service{<br />
notification_interval&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  30<br />
check_period&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 24x7<br />
use generic-service<br />
host_name xeno<br />
service_description Check IO Wait<br />
check_command check_nrpe!check_chris<br />
notification_options n<br />
contact_groups unix<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>chris5126</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225110.html</guid>
		</item>
		<item>
			<title>Record too long.......</title>
			<link>http://www.daniweb.com/forums/thread225014.html</link>
			<pubDate>Wed, 23 Sep 2009 04:56:36 GMT</pubDate>
			<description><![CDATA[Hi, 
I am trying to log a portion of the log file depending upon the "WorkOrderNumber" and "level". 
The shell script i've written is as follows:- 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
I am trying to log a portion of the log file depending upon the &quot;WorkOrderNumber&quot; and &quot;level&quot;.<br />
The shell script i've written is as follows:-<br />
 <pre style="margin:20px; line-height:13px">cat input.log | awk '/\[WorkOrderNumber/' | awk /120600012/ | awk /INFO/ | tee log.vw</pre><br />
For a particular WorkOrderNumber, the record is very long (4253 characters).<br />
<br />
When I run the script I get following message:-<br />
<br />
<span style="color:Red">awk: record `[2009-09-17 08:26]IN...' too long<br />
 record number 882</span><br />
<br />
How to get rid of this error?<br />
I don't want to tamper with input.log file.<br />
<br />
Please help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>axeeffect2002</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225014.html</guid>
		</item>
		<item>
			<title>Grep : Trying to match a trailing backslash (\)</title>
			<link>http://www.daniweb.com/forums/thread225004.html</link>
			<pubDate>Wed, 23 Sep 2009 04:23:56 GMT</pubDate>
			<description><![CDATA[Hi 
i am trying to write a script to match a '\' at the END of the line. 
For eg. i have a  file Temp1 which contains :- 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680"...]]></description>
			<content:encoded><![CDATA[<div>Hi<br />
i am trying to write a script to match a '\' at the END of the line.<br />
For eg. i have a  file Temp1 which contains :-<br />
<br />
 <pre style="margin:20px; line-height:13px">a = b + c \<br />
+d;<br />
printf(&quot;\n&quot;);</pre><br />
Objective:<br />
To match the '\' in the 1st line and NOT the 3rd line (line with the printf)<br />
<br />
When i try<br />
 <pre style="margin:20px; line-height:13px">grep '\\' Temp1</pre>i am shown the 1st line and the 3rd line. However, i don't want the 3rd line.<br />
<br />
Similarly, when i try<br />
 <pre style="margin:20px; line-height:13px">grep '\\$' Temp1</pre>it does not work.<br />
<br />
Plz help !</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>kneiel</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread225004.html</guid>
		</item>
		<item>
			<title><![CDATA[Can't access]]></title>
			<link>http://www.daniweb.com/forums/thread223935.html</link>
			<pubDate>Fri, 18 Sep 2009 04:57:08 GMT</pubDate>
			<description>Dear All, 
 
i have the linux machine. i am a admin(root) of the system. i have create a user yesterday. now i login user i saw this error.. pls help me...  
 
-bash: /home/user/.bash_profile: Permission denied</description>
			<content:encoded><![CDATA[<div>Dear All,<br />
<br />
i have the linux machine. i am a admin(root) of the system. i have create a user yesterday. now i login user i saw this error.. pls help me... <br />
<br />
-bash: /home/user/.bash_profile: Permission denied</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>danielraj</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread223935.html</guid>
		</item>
		<item>
			<title>please help</title>
			<link>http://www.daniweb.com/forums/thread223566.html</link>
			<pubDate>Wed, 16 Sep 2009 19:21:48 GMT</pubDate>
			<description>ok.  There is a window xp base production server contained video files for play out. There is another server which is a linux base server placed in the network of the window xp based production server. I normally copy the files in the windo xp production server to the linux server for...</description>
			<content:encoded><![CDATA[<div>ok.  There is a window xp base production server contained video files for play out. There is another server which is a linux base server placed in the network of the window xp based production server. I normally copy the files in the windo xp production server to the linux server for storage/backup and also compy it back to the window xp server at a time t. Now I want a shell script to automate this process. please help</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>haykins</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread223566.html</guid>
		</item>
		<item>
			<title>autosave opened excel from Command from in Windows</title>
			<link>http://www.daniweb.com/forums/thread223091.html</link>
			<pubDate>Tue, 15 Sep 2009 03:15:56 GMT</pubDate>
			<description>dear all,, 
 
I just try to make script  to autosave an opened excel that auto refresh every 3 hours. Every 3 hours the data will be added to excel,, cause the excel will take data from database (that the cause I need to autorefresh). 
 
but I need to autosave it too. I use M.Office 2003. In M....</description>
			<content:encoded><![CDATA[<div>dear all,,<br />
<br />
I just try to make script  to autosave an opened excel that auto refresh every 3 hours. Every 3 hours the data will be added to excel,, cause the excel will take data from database (that the cause I need to autorefresh).<br />
<br />
but I need to autosave it too. I use M.Office 2003. In M. Office 2003, the output of autosave just a temporary. So I just, copy the temporary, n rename it. But, I want to make it, just to make command from CMD to save my opened excel that every 3 hours will be added.<br />
<br />
tiil now, I just make this code :<br />
<br />
 <pre style="margin:20px; line-height:13px">for /F &quot;usebackq&quot; %%A IN (`dir /O:D /B *.xls`) do (<br />
set FI=%%A<br />
)<br />
ren %fi% sample.xls<br />
del D:\db_duplicate\sample.xls<br />
xcopy sample.xls D:\db_duplicate\</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>VIkhers</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread223091.html</guid>
		</item>
		<item>
			<title>shell help</title>
			<link>http://www.daniweb.com/forums/thread222689.html</link>
			<pubDate>Sun, 13 Sep 2009 12:57:30 GMT</pubDate>
			<description><![CDATA[hello, 
 
i am writing my own shell and struck at implementing "help"....can any  one help me .....plz just dont refer the man pages of linux plz elaborate also.... 
 
 
also plz some one tell me how to implement the background processing .....reply asaap its urgent 
 
thanks in advance]]></description>
			<content:encoded><![CDATA[<div>hello,<br />
<br />
i am writing my own shell and struck at implementing &quot;help&quot;....can any  one help me .....plz just dont refer the man pages of linux plz elaborate also....<br />
<br />
<br />
also plz some one tell me how to implement the background processing .....reply asaap its urgent<br />
<br />
thanks in advance</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>pkgr8</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread222689.html</guid>
		</item>
		<item>
			<title>Kill top 5 processes</title>
			<link>http://www.daniweb.com/forums/thread222263.html</link>
			<pubDate>Fri, 11 Sep 2009 14:52:29 GMT</pubDate>
			<description>I want to write a script where in i can kill the top processes and run this script for every 5 minutes.How to extract parameters from top command</description>
			<content:encoded><![CDATA[<div>I want to write a script where in i can kill the top processes and run this script for every 5 minutes.How to extract parameters from top command</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>kranny</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread222263.html</guid>
		</item>
		<item>
			<title>book in shell script(india)</title>
			<link>http://www.daniweb.com/forums/thread221846.html</link>
			<pubDate>Wed, 09 Sep 2009 21:29:14 GMT</pubDate>
			<description>Can somebody suggest me, which book is best for shell script and available in India ??</description>
			<content:encoded><![CDATA[<div>Can somebody suggest me, which book is best for shell script and available in India ??</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>lipun4u</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221846.html</guid>
		</item>
		<item>
			<title>script not competing</title>
			<link>http://www.daniweb.com/forums/thread221491.html</link>
			<pubDate>Tue, 08 Sep 2009 15:54:00 GMT</pubDate>
			<description><![CDATA[I have a helper script that will grab weblogs for a particular domain, if called by itself from the MS-DOS command line it works as intended, but I'd like to call another script to call this script multiple times for the multiple domains, but it's only running the first call to the script and...]]></description>
			<content:encoded><![CDATA[<div>I have a helper script that will grab weblogs for a particular domain, if called by itself from the MS-DOS command line it works as intended, but I'd like to call another script to call this script multiple times for the multiple domains, but it's only running the first call to the script and exiting out.<br />
<br />
Is there a way to include helper batch files and have them all run sequentially?<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">g:<br />
cd g:\mydir&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
rem collecting log files<br />
getlogs.bat site1<br />
getlogs.bat site2<br />
getlogs.bat site3<br />
getlogs.bat site4<br />
getlogs.bat site5<br />
getlogs.bat site6</pre><br />
:cool:</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>fayola</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221491.html</guid>
		</item>
		<item>
			<title>how to implement cd</title>
			<link>http://www.daniweb.com/forums/thread221488.html</link>
			<pubDate>Tue, 08 Sep 2009 15:50:28 GMT</pubDate>
			<description>HELLO 
 
I Am writin my own shell in linux, and making use of execvp() for handling internal commands but it does not supports cd...plz help 
 
also if anyone can suggest some another way to handle internal calls except using system() 
 
thanks in advance :-)</description>
			<content:encoded><![CDATA[<div>HELLO<br />
<br />
I Am writin my own shell in linux, and making use of execvp() for handling internal commands but it does not supports cd...plz help<br />
<br />
also if anyone can suggest some another way to handle internal calls except using system()<br />
<br />
thanks in advance :-)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>pkgr8</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221488.html</guid>
		</item>
		<item>
			<title>Windows script for moving file(s) to hidden path</title>
			<link>http://www.daniweb.com/forums/thread221116.html</link>
			<pubDate>Mon, 07 Sep 2009 09:41:46 GMT</pubDate>
			<description><![CDATA[Hi, 
i hope I'm posting about right topic. 
I need to be able to move file(s) from a directory to another directory which the user does not have access to(i.e. they can't view/access the folder). 
Can this be done with scripts? 
The environment is a windows server 2003 network. 
 
-Thanks]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
i hope I'm posting about right topic.<br />
I need to be able to move file(s) from a directory to another directory which the user does not have access to(i.e. they can't view/access the folder).<br />
Can this be done with scripts?<br />
The environment is a windows server 2003 network.<br />
<br />
-Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>stoymigo</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread221116.html</guid>
		</item>
		<item>
			<title>Very new to this and would appreciate any help possible.</title>
			<link>http://www.daniweb.com/forums/thread215837.html</link>
			<pubDate>Wed, 02 Sep 2009 22:14:46 GMT</pubDate>
			<description><![CDATA[I am attempting to familiarize myself with BASH so i can work in a Unix environment.  I want to export a shell variable to a simple C program but seem to be unable to do so.   
 
Here is the C program: (i am also very unfamiliar with C but this came from a tutorial so i don't think it is is...]]></description>
			<content:encoded><![CDATA[<div>I am attempting to familiarize myself with BASH so i can work in a Unix environment.  I want to export a shell variable to a simple C program but seem to be unable to do so.  <br />
<br />
Here is the C program: (i am also very unfamiliar with C but this came from a tutorial so i don't think it is is incorrect) <br />
 <pre style="margin:20px; line-height:13px">#include &lt;stdio.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
<br />
int main(void) {<br />
&nbsp; char *myenvvar=getenv(&quot;EDITOR&quot;);<br />
&nbsp; printf(&quot;The editor environment variable is set to %s\n&quot;,myenvvar);<br />
}</pre><br />
i compile it and have the executable all set and ready,  and then in BASH i was thinking something as simple as &quot;&gt; export $EDITOR='emacs' \n&quot; should work and export the shell variable to someplace my C program can access it. <br />
<br />
Am i making some stupid mistake? (i hope i am)  or do i have this totally wrong?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>Ctpwwner</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread215837.html</guid>
		</item>
		<item>
			<title>Need shell script for extracting website content for a list of given websites</title>
			<link>http://www.daniweb.com/forums/thread215085.html</link>
			<pubDate>Mon, 31 Aug 2009 01:24:15 GMT</pubDate>
			<description><![CDATA[Hello,  
 
I have used bash scripting for sometime in the past and know quite a  
bit of linux. But haven't used it in a long time.  
 
I am off job and took some data entry job where I need to do some stats work on a very long list of websites. 
 
This I get from a website called quantcast.com...]]></description>
			<content:encoded><![CDATA[<div>Hello, <br />
<br />
I have used bash scripting for sometime in the past and know quite a <br />
bit of linux. But haven't used it in a long time. <br />
<br />
I am off job and took some data entry job where I need to do some stats work on a very long list of websites.<br />
<br />
This I get from a website called quantcast.com which gives <br />
statistics of other web sites when I put the other site from the list <br />
I already have, each into the SITENAME field here: <br />
<br />
<a rel="nofollow" class="t" href="http://www.quantcast.com/SITENAME/demographics" target="_blank">http://www.quantcast.com/SITENAME/demographics</a> <br />
<br />
<br />
Here's the url for google.nl stats on quantcast:<br />
<br />
<a rel="nofollow" class="t" href="http://www.quantcast.com/google.nl/demographics" target="_blank">http://www.quantcast.com/google.nl/demographics</a><br />
<br />
<br />
Here's an example below for google.nl in place of the above SITENAME: <br />
<br />
<a rel="nofollow" class="t" href="http://s995.photobucket.com/albums/af80/unknownbucket/?action=view&amp;current=quantcast.jpg" target="_blank">http://s995.photobucket.com/albums/a...=quantcast.jpg</a><br />
<br />
<br />
(The problem now is that the quantcast.com site gives the stats in images instead of text so I will have a hard time getting the values out of the images.)<br />
<br />
<br />
After getting this kind of list, it has to be input into the xls <br />
sheet. So I will need this information in some kind of file format <br />
which can be converted  or imported into excel easily. CSV etc I <br />
guess. <br />
<br />
I know this can be done but I will need to learn quite a lot of bash <br />
scripting again. I have not used it since some time. <br />
<br />
Can someone please help me making this script. I will be able to <br />
understand the basics for sure.<br />
<br />
<br />
<br />
<br />
This is what I had intended to to at first, when I didn't know that the stats are in images rather than text:<br />
<br />
<br />
What I had intended to do was in these steps: <br />
<br />
1. Copy / Paste the site list into a text file. (Each site is on a <br />
newline already.) <br />
<br />
2. Use something like sed/awk etc to insert the <a rel="nofollow" class="t" href="http://www.quantcast.com/" target="_blank">http://www.quantcast.com/</a> <br />
before each of these sitenames. <br />
<br />
3, To each of the result in (2) above, insert the word &quot;/demographics&quot; <br />
at the end of the urls. <br />
<br />
4. The above will now be a file with links to each of the sites on <br />
quantcast.com. Using wget, download each page and save them with some <br />
names or numbers. <br />
<br />
5. Tidy the html or somehow batch-convert the html to plain-text. <br />
<br />
6. From this file, get the given field-names and their values (that <br />
is, the numbers) and save this info for each site into a new file also <br />
including only the original sitename (without the quantcast.com), <br />
using the cut command or something. <br />
<br />
7. Convert this file into a CSV or tab-delimited format. <br />
<br />
The CSV conversion as per me would be the last thing to do. <br />
<br />
But first, I need to try to get each page, save it with a numbered <br />
name, then extract the images. <br />
<br />
Save the images for each site in separate folders. <br />
(The image names are the same for example they are like demograp.png, <br />
demograq.png, demograr.png, demogras.png) <br />
<br />
And then extract the content of each image using any utility I can <br />
find. I hope this part really can be done.<br />
<br />
<br />
<br />
Any help Very Much appreciated and thanks, <br />
Regards, <br />
deboo</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>deboogeek</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread215085.html</guid>
		</item>
		<item>
			<title>Change Layout</title>
			<link>http://www.daniweb.com/forums/thread214397.html</link>
			<pubDate>Thu, 27 Aug 2009 13:02:36 GMT</pubDate>
			<description>Is it possible to change the desktop background, hide the desktop icons, and hide the menu bar (in windows) using a batch script?  If not, could someone direct me as to how to do it in C/C++? 
 
Thanks</description>
			<content:encoded><![CDATA[<div>Is it possible to change the desktop background, hide the desktop icons, and hide the menu bar (in windows) using a batch script?  If not, could someone direct me as to how to do it in C/C++?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>waldchr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread214397.html</guid>
		</item>
		<item>
			<title>Need SFTP script</title>
			<link>http://www.daniweb.com/forums/thread214120.html</link>
			<pubDate>Wed, 26 Aug 2009 14:09:06 GMT</pubDate>
			<description>Hi All, 
 
I am new in SFTP. 
1)I need to transfer the file from one server to another server. 
2) I have written .com file in my ALPHA VMS system with SQLquery. 
3) Usually I send .com file through NDM protocol. In this file i write NDM script in the file for sending the file. 
 
$!copy/log...</description>
			<content:encoded><![CDATA[<div>Hi All,<br />
<br />
I am new in SFTP.<br />
1)I need to transfer the file from one server to another server.<br />
2) I have written .com file in my ALPHA VMS system with SQLquery.<br />
3) Usually I send .com file through NDM protocol. In this file i write NDM script in the file for sending the file.<br />
<br />
$!copy/log ie_acctinfo.dat MEDDEV::NDM_SEND:ie_acctinfo.dat<br />
<br />
$!copy/log nl:                      MEDDEV::NDM_SEND:ie_acctinfo.dat_ack<br />
<br />
this script we use inside the file. and then we can submit the file <br />
<br />
@ie_acctinfo.com<br />
--------------------------------<br />
But this enhancement(project) I should use SFTP(SSH).<br />
1) Both system(myside and other application(server)) side are generated and exchanged the public key.<br />
2) now i need to the SFTP script inside the .com file and send(submit) SFTP script.<br />
<br />
I really appriciate your help and spending time for me.<br />
<br />
Thanks, prabha</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>prabha24107</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread214120.html</guid>
		</item>
		<item>
			<title>script to run java program</title>
			<link>http://www.daniweb.com/forums/thread214117.html</link>
			<pubDate>Wed, 26 Aug 2009 13:47:41 GMT</pubDate>
			<description>I want to run multiple test cases, for a java program. How can i write script that causes the same program to run for different test cases. 
 
Test cases need to be included in same file or different files? how to write the script?</description>
			<content:encoded><![CDATA[<div>I want to run multiple test cases, for a java program. How can i write script that causes the same program to run for different test cases.<br />
<br />
Test cases need to be included in same file or different files? how to write the script?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>shraddha_gupta</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread214117.html</guid>
		</item>
		<item>
			<title>How can i display time 5mins ago on Solaris 10</title>
			<link>http://www.daniweb.com/forums/thread214071.html</link>
			<pubDate>Wed, 26 Aug 2009 10:43:51 GMT</pubDate>
			<description><![CDATA[Hi  
 
Im writing a script where im using the date command in this format. 
 
[Datestart=`date '+%m/%d/%Y':'%H:%M:%S'`] 
 
Is their a way to force the date variable above to go back 5minutes?? 
 
I know their is a way in perl but i prefer writing this script in ksh]]></description>
			<content:encoded><![CDATA[<div>Hi <br />
<br />
Im writing a script where im using the date command in this format.<br />
<br />
[Datestart=`date '+%m/%d/%Y':'%H:%M:%S'`]<br />
<br />
Is their a way to force the date variable above to go back 5minutes??<br />
<br />
I know their is a way in perl but i prefer writing this script in ksh</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>skelly16</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread214071.html</guid>
		</item>
		<item>
			<title>A shell script that makes backup copies of changed files (also involving CRON)</title>
			<link>http://www.daniweb.com/forums/thread213907.html</link>
			<pubDate>Tue, 25 Aug 2009 19:24:16 GMT</pubDate>
			<description>Hey 
 
Ive been asked (and I may add this to my system as well) to make a shell script that backups to all files in x location to another location in z. The thing is that the backup must only be made if one file has been changed. Example: 
 
/x contains: 
 
a (1 byte) 
b (1 byte) 
c  (1 byte)</description>
			<content:encoded><![CDATA[<div>Hey<br />
<br />
Ive been asked (and I may add this to my system as well) to make a shell script that backups to all files in x location to another location in z. The thing is that the backup must only be made if one file has been changed. Example:<br />
<br />
/x contains:<br />
<br />
a (1 byte)<br />
b (1 byte)<br />
c  (1 byte)<br />
<br />
/y contains:<br />
<br />
nothing<br />
<br />
Ill put this script into CRON's file and everytime (say 3) it will execute. 3 arrives and there is nothing in /y and it will copy all files in /x to /y. To compensate space I think a good idea (this I will do to my script for my system) is gzip it all up. Anyways the current state right now is.<br />
<br />
/x contains:<br />
<br />
a (1 byte)<br />
b (1 byte)<br />
c  (1 byte)<br />
<br />
/y contains:<br />
<br />
a (1 byte)<br />
b (1 byte)<br />
c  (1 byte)<br />
<br />
Again 3 arrives and /y is the same as /x so nothing changes and nothing happens. But now, I open c in /x and type something inside now it is:<br />
<br />
/x contains:<br />
<br />
a (1 byte)<br />
b (1 byte)<br />
c  (2 bytes)<br />
<br />
This changes it so now when the script excutes at 3 it has to delete everything in /y and rewrite it all over again (regardless that the other files havent changed).<br />
<br />
How do I do this? I imagine something like doing a ls -a on /x and using cut to cut certain columns and seeing if it equals /y's files/file sizes but im not sure how to make a filename and file size relation and a bit humiliating but I dont know how to use cut either (I know something but still)<br />
<br />
If someone could help thank you very much.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>riahc3</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread213907.html</guid>
		</item>
		<item>
			<title>How not to show messages?</title>
			<link>http://www.daniweb.com/forums/thread213861.html</link>
			<pubDate>Tue, 25 Aug 2009 15:29:52 GMT</pubDate>
			<description><![CDATA[Hi all 
I just have questions about 
how not to show messages after you execute a certain command. 
 
for example whenever you execute "which xxx" 
there will always be a message on the terminal  
saying its path or command not found will be written. 
 
is that possible to write a shell script file...]]></description>
			<content:encoded><![CDATA[<div>Hi all<br />
I just have questions about<br />
how not to show messages after you execute a certain command.<br />
<br />
for example whenever you execute &quot;which xxx&quot;<br />
there will always be a message on the terminal <br />
saying its path or command not found will be written.<br />
<br />
is that possible to write a shell script file <br />
without showing these kind of messages? <br />
<br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>darangho</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread213861.html</guid>
		</item>
		<item>
			<title>Issue with sed and date variable - Suffix too large - 512 max</title>
			<link>http://www.daniweb.com/forums/thread213799.html</link>
			<pubDate>Tue, 25 Aug 2009 09:15:59 GMT</pubDate>
			<description><![CDATA[Hi All 
 
Facing issue with using sed and globally replacing a word with date variable for a sql file. 
 
Any help would be appreciated. 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hi All<br />
<br />
Facing issue with using sed and globally replacing a word with date variable for a sql file.<br />
<br />
Any help would be appreciated.<br />
<br />
 <pre style="margin:20px; line-height:13px">sed -e &quot;s/DATEST\/$DATESTART/g&quot; $SQLREAD &gt; $SQLNEW<br />
<br />
sed -e &quot;s/DATEST\/08/25/2009:07:41:41/g&quot; /uat/ut21_sysmon/quest/foglight/JJ/jjsql<br />
Suffix too large - 512 max: s/DATEST\/08/25/2009:07:41:41/g</pre><br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>skelly16</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread213799.html</guid>
		</item>
		<item>
			<title>EventHandler using Shell script</title>
			<link>http://www.daniweb.com/forums/thread213426.html</link>
			<pubDate>Sun, 23 Aug 2009 17:05:10 GMT</pubDate>
			<description>Hi all, 
 
I try to make a system where client can send their sms (contained contact file in it that compressed) to server using sms gateway concept. In this case, server must handle 3 condition : registration, request sending file to server (by client), and request take file in server (by client,...</description>
			<content:encoded><![CDATA[<div>Hi all,<br />
<br />
I try to make a system where client can send their sms (contained contact file in it that compressed) to server using sms gateway concept. In this case, server must handle 3 condition : registration, request sending file to server (by client), and request take file in server (by client, and server will be send it to client).<br />
<br />
In this case, I separate this plan by two side : client side and server side.<br />
<br />
In client side, I'm develop an application (jar) using J2ME that can read/write phonebook (in symbian S60), compression contact (client can select how many contact that they want to compress), and send it to server via sms. My application run well in my Nokia N81 8GB when I test it.<br />
<br />
In server side, case of this topic, I'm use sms gateway concept to send and receive sms from and to client (also using database mysql). Database will saving 4 things (in 4 field) : ID client (generate by server in client registration phase), name+phone number of client (that contained in sms of registration), and file backup phone book (that send by client in sending file phase, in form of sms). My question focus in server side.<br />
<br />
I want to make an script for the eventhandler (will be add on /etc/smsd.conf) that contain with that three condition above. I'll explain each phase below :<br />
1. ) In registration phase.<br />
Check incoming sms from client that register to server via SMS.<br />
If incoming sms contain &quot;reg&quot; (not case sensitive), server will generate an ID for client (ie : Cxxx) and send a sms : &quot;$name, thanks for registration. Your ID is $id_client_that_generated_by_server_after_client_registration&quot;<br />
If sms didn't contain &quot;reg&quot;, server will send client a sms that contain message &quot;Sorry, your format is wrong. Type : REG#your_name&quot;.<br />
<br />
2.) Request sending file to server (by client) phase.<br />
Check incoming sms from client that contain &quot;KRM#id_client&quot; (KRM not case sensitive).<br />
If incoming sms didn't contain &quot;krm&quot; and or wrong/not valid ID, server will send client a sms &quot;The format of your sms and or your ID is wrong. Type KRM#ID&quot;<br />
If it's true, server will send a sms to client :&quot;$name, now you may send files to server&quot;.<br />
And after client send their file to server via sms and server received it, server will send sms report to client : &quot;$name, your file was saved in the server&quot;.<br />
<br />
3. Check incoming sms form client that contain &quot;GET#id_client&quot; (GET not case sensitive).<br />
If incoming sms didn't contain &quot;get&quot; and or wrong/not valid ID, server will send client a sms &quot;your format of sms or your ID is wrong. Type GEt#ID&quot;<br />
If it's true, server will send a sms to client :&quot;$name, wait a minutes. We will send your file via SMS&quot;.<br />
<br />
I've try to write the script (based on example of sms server tools and also my friend) to solve my problem in server side above (but &quot;reg&quot; only, I can't for &quot;krm&quot; and &quot;get&quot; ), in attachmnt.<br />
<br />
I've try it at SMS Server Tools (as shell script in eventhandler /etc/smsd.conf), but it only run well when I'm send a sms that contain wrong format (ex : ref#jhon) and server will send me a sms that contain message &quot;your format is worng. Type : reg#name&quot;.<br />
<br />
But if my format valid, it can't generate ID for client (in this case is sender, myself), store data (name, ID, telp number) in database, and also can't send client sms that contain format &quot;$nama, your registration is complete. your Id is xxx&quot;.<br />
<br />
help me to solve my problem and complete my script. Thanks,</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>deathknell</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread213426.html</guid>
		</item>
		<item>
			<title>Need help to write a backup script...</title>
			<link>http://www.daniweb.com/forums/thread213085.html</link>
			<pubDate>Fri, 21 Aug 2009 18:58:04 GMT</pubDate>
			<description><![CDATA[Helo frndz, 
I'm novice in shell scripting...I need ur frnd help to write a shell script for taking backups. This script should use cp command to take backups. Script can read the list of directories and destination directory from a file or ask user for this info interactively... 
 
Example: 
Only...]]></description>
			<content:encoded><![CDATA[<div>Helo frndz,<br />
I'm novice in shell scripting...I need ur frnd help to write a shell script for taking backups. This script should use cp command to take backups. Script can read the list of directories and destination directory from a file or ask user for this info interactively...<br />
<br />
Example:<br />
Only two options -i (for interactive run) and &quot;-f file&quot; (to read backup info from a file) are allowed. When an invalid option is entered, script displays a message in shown below:<br />
$ a2backup -r<br />
syntax: a2backup [ -i/ -f file]<br />
<br />
$ a2backup -i<br />
Welcome to the Interactive Backup utility<br />
Enter the source directory [/home/maskara/sya710]:<br />
Enter the destination directory: /home/backup<br />
What type of backup do you want ( [i]ncremental / [f]ull backup) [i]: <br />
Follow symbolic link (Y/N) [n]:<br />
Directory backed up successfully...<br />
<br />
Plz help me to do this...:( ...<br />
<br />
Thnx</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>baula</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread213085.html</guid>
		</item>
		<item>
			<title>Unix compiler/code tags help with mac os x</title>
			<link>http://www.daniweb.com/forums/thread212549.html</link>
			<pubDate>Wed, 19 Aug 2009 17:30:28 GMT</pubDate>
			<description><![CDATA[Hello, I would like to download a compiler that works with max os x MacBook Pro that when doing my Unix homework I can compile and then know it works before I go to the University's website to log in and run the program.  Or do I have to use my parrallels desktop on my Mac for a complier to use...]]></description>
			<content:encoded><![CDATA[<div>Hello, I would like to download a compiler that works with max os x MacBook Pro that when doing my Unix homework I can compile and then know it works before I go to the University's website to log in and run the program.  Or do I have to use my parrallels desktop on my Mac for a complier to use bash/unix code?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>pixiewolfe</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread212549.html</guid>
		</item>
		<item>
			<title>extract multiple cloumns from multiple files; skip rows and include filenames; awk</title>
			<link>http://www.daniweb.com/forums/thread212529.html</link>
			<pubDate>Wed, 19 Aug 2009 16:16:26 GMT</pubDate>
			<description>Hello, 
 
I am trying to write a bash shell script that does the following: 
 
I would really appreciate if someone can help me correct my code that i have written below: 
 
1.Finds all *.txt files within my directory of interest (files are in sub-directories) 
2. reads each of the files (25 files)...</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am trying to write a bash shell script that does the following:<br />
<br />
I would really appreciate if someone can help me correct my code that i have written below:<br />
<br />
1.Finds all *.txt files within my directory of interest (files are in sub-directories)<br />
2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format)<br />
3. skips the first 10 rows of the file<br />
4. extracts and prints out columns 2,14 , 15 into one output file<br />
5. adds a new column to the final output file with the name of the txt file from where the data was extracted.<br />
<br />
I have written a shell script which is not working properly and doesnot have the code for the part to skip 10 rows.<br />
<br />
Below I have pasted a sample input file, output file and my code<br />
Input file format: The actual data starts from the line:<br />
DATA	1	1	1		0<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px"> <br />
TYPE&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer<br />
FEPARAMS&nbsp; &nbsp; &nbsp; &nbsp; Protocol_Name&nbsp; &nbsp; &nbsp; &nbsp; Protocol_date&nbsp; &nbsp; &nbsp; &nbsp; Scan_Date&nbsp; &nbsp; &nbsp; &nbsp; Scan_ScannerName&nbsp; &nbsp; &nbsp; &nbsp; Scan_NumChannels&nbsp; &nbsp; &nbsp; &nbsp; Scan_MicronsPerPixelX&nbsp; &nbsp; &nbsp; &nbsp; Scan_MicronsPerPixelY&nbsp; &nbsp; &nbsp; &nbsp; Scan_OriginalGUID&nbsp; &nbsp; &nbsp; &nbsp; Grid_Name&nbsp; &nbsp; &nbsp; &nbsp; Grid_Date&nbsp; &nbsp; &nbsp; &nbsp; Grid_NumSubGridRows&nbsp; &nbsp; &nbsp; &nbsp; Grid_NumSubGridCols&nbsp; &nbsp; &nbsp; &nbsp; Grid_NumRows&nbsp; &nbsp; &nbsp; &nbsp; Grid_NumCols<br />
DATA&nbsp; &nbsp; &nbsp; &nbsp; miRNA-v1_95_May07 (Read Only)&nbsp; &nbsp; &nbsp; &nbsp; 5/2/2007 12:14&nbsp; &nbsp; &nbsp; &nbsp; 1/26/2008 11:25&nbsp; &nbsp; &nbsp; &nbsp; Agilent Technologies Scanner G2505B US45102930&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 5&nbsp; &nbsp; &nbsp; &nbsp; 5&nbsp; &nbsp; &nbsp; &nbsp; a18d8bd4-628a-4054-b2ba-45c7a66de583&nbsp; &nbsp; &nbsp; &nbsp; 016436_D_20070426&nbsp; &nbsp; &nbsp; &nbsp; 4/26/2007 0:00&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 192&nbsp; &nbsp; &nbsp; &nbsp; 82<br />
*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
TYPE&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; integer<br />
STATS&nbsp; &nbsp; &nbsp; &nbsp; gDarkOffsetAverage&nbsp; &nbsp; &nbsp; &nbsp; gDarkOffsetMedian&nbsp; &nbsp; &nbsp; &nbsp; gDarkOffsetStdDev&nbsp; &nbsp; &nbsp; &nbsp; gDarkOffsetNumPts&nbsp; &nbsp; &nbsp; &nbsp; gSaturationValue&nbsp; &nbsp; &nbsp; &nbsp; gAvgSig2BkgNegCtrl&nbsp; &nbsp; &nbsp; &nbsp; gNumSatFeat&nbsp; &nbsp; &nbsp; &nbsp; gLocalBGInlierNetAve&nbsp; &nbsp; &nbsp; &nbsp; gLocalBGInlierAve&nbsp; &nbsp; &nbsp; &nbsp; gLocalBGInlierSDev&nbsp; &nbsp; &nbsp; &nbsp; gLocalBGInlierNum&nbsp; &nbsp; &nbsp; &nbsp; gGlobalBGInlierAve&nbsp; &nbsp; &nbsp; &nbsp; gGlobalBGInlierSDev&nbsp; &nbsp; &nbsp; &nbsp; gGlobalBGInlierNum<br />
DATA&nbsp; &nbsp; &nbsp; &nbsp; 26.709&nbsp; &nbsp; &nbsp; &nbsp; 27&nbsp; &nbsp; &nbsp; &nbsp; 5.44777&nbsp; &nbsp; &nbsp; &nbsp; 1000&nbsp; &nbsp; &nbsp; &nbsp; 1203179&nbsp; &nbsp; &nbsp; &nbsp; 1.11899&nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 38.7173&nbsp; &nbsp; &nbsp; &nbsp; 65.4263&nbsp; &nbsp; &nbsp; &nbsp; 2.95429&nbsp; &nbsp; &nbsp; &nbsp; 12029&nbsp; &nbsp; &nbsp; &nbsp; 65.4263&nbsp; &nbsp; &nbsp; &nbsp; 2.95429&nbsp; &nbsp; &nbsp; &nbsp; 12029<br />
*&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
TYPE&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; integer&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; text&nbsp; &nbsp; &nbsp; &nbsp; float&nbsp; &nbsp; &nbsp; &nbsp; float<br />
FEATURES&nbsp; &nbsp; &nbsp; &nbsp; FeatureNum&nbsp; &nbsp; &nbsp; &nbsp; Row&nbsp; &nbsp; &nbsp; &nbsp; Col&nbsp; &nbsp; &nbsp; &nbsp; chr_coord&nbsp; &nbsp; &nbsp; &nbsp; SubTypeMask&nbsp; &nbsp; &nbsp; &nbsp; SubTypeName&nbsp; &nbsp; &nbsp; &nbsp; ProbeUID&nbsp; &nbsp; &nbsp; &nbsp; ControlType&nbsp; &nbsp; &nbsp; &nbsp; ProbeName&nbsp; &nbsp; &nbsp; &nbsp; GeneName&nbsp; &nbsp; &nbsp; &nbsp; SystematicName&nbsp; &nbsp; &nbsp; &nbsp; Description&nbsp; &nbsp; &nbsp; &nbsp; PositionX&nbsp; &nbsp; &nbsp; &nbsp; PositionY<br />
DATA&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; miRNABrightCorner30&nbsp; &nbsp; &nbsp; &nbsp; miRNABrightCorner30&nbsp; &nbsp; &nbsp; &nbsp; miRNABrightCorner30&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6774.29&nbsp; &nbsp; &nbsp; &nbsp; 228.723<br />
DATA&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 66&nbsp; &nbsp; &nbsp; &nbsp; Structural&nbsp; &nbsp; &nbsp; &nbsp; 2&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; DarkCorner&nbsp; &nbsp; &nbsp; &nbsp; DarkCorner&nbsp; &nbsp; &nbsp; &nbsp; DarkCorner&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 6800.2&nbsp; &nbsp; &nbsp; &nbsp; 229.421<br />
DATA&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; chr14:100595916-100595897&nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 3&nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; A_25_P00010115&nbsp; &nbsp; &nbsp; &nbsp; hsa-miR-154*&nbsp; &nbsp; &nbsp; &nbsp; hsa-miR-154*&nbsp; &nbsp; &nbsp; &nbsp; NA&nbsp; &nbsp; &nbsp; &nbsp; 6826.51&nbsp; &nbsp; &nbsp; &nbsp; 228.385<br />
DATA&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp; 1&nbsp; &nbsp; &nbsp; &nbsp; 4&nbsp; &nbsp; &nbsp; &nbsp; chr8:135881995-135882010&nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5&nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; A_25_P00010390&nbsp; &nbsp; &nbsp; &nbsp; hsa-miR-30b&nbsp; &nbsp; &nbsp; &nbsp; hsa-miR-30b&nbsp; &nbsp; &nbsp; &nbsp; NA&nbsp; &nbsp; &nbsp; &nbsp; 6850.48&nbsp; &nbsp; &nbsp; &nbsp; 228.853</pre>Output format: tab delimited file. The last column shows the filename from which the data was extracted<br />
<br />
 <pre style="margin:20px; line-height:13px">1 6774.29 228.723 ABC.txt <br />
2 6800.2 229.421 ABC.txt <br />
3 6826.51 228.385 DEF.txt <br />
4 6850.48 228.853 DEF.txt <br />
5 6875.37 228.408 XYZ.txt <br />
6 6900.98 229.321 XYZ.txt</pre>My incomplete code: It is missing the skipping rows steps. Also it throws an error:<br />
<br />
'test1.sh: line 3: syntax error near unexpected token `do<br />
'test1.sh: line 3: `do<br />
<br />
 <pre style="margin:20px; line-height:13px">for filename in $(find -iname '*.txt') <br />
do<br />
&nbsp;awk -F&quot;\t&quot; ' <br />
&nbsp; &nbsp; BEGIN {OFS=&quot;|&quot;} {print $2,$14,$15,FILENAME}<br />
&nbsp; &nbsp; ' $filename &gt; output.txt<br />
done</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>biobee07</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread212529.html</guid>
		</item>
		<item>
			<title>What does @_ mean????</title>
			<link>http://www.daniweb.com/forums/thread212476.html</link>
			<pubDate>Wed, 19 Aug 2009 09:51:06 GMT</pubDate>
			<description>Please some one can you tell me what is @_ mean?</description>
			<content:encoded><![CDATA[<div>Please some one can you tell me what is @_ mean?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>krishnendhu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread212476.html</guid>
		</item>
		<item>
			<title>date command</title>
			<link>http://www.daniweb.com/forums/thread212465.html</link>
			<pubDate>Wed, 19 Aug 2009 08:23:21 GMT</pubDate>
			<description><![CDATA[HI Guys, 
 
Prob a very simple one but im stumped, I run the following command and get: 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code...]]></description>
			<content:encoded><![CDATA[<div>HI Guys,<br />
<br />
Prob a very simple one but im stumped, I run the following command and get:<br />
<br />
 <pre style="margin:20px; line-height:13px">date<br />
Wednesday, 19 August 2009 09:20:59 BST</pre>But when I run<br />
 <pre style="margin:20px; line-height:13px">date -u '+%y%m%d.%H:%M:%S'<br />
090819.08:21:27</pre><br />
My question is why is the second command an hour behind? In my environment the following are set:<br />
 <pre style="margin:20px; line-height:13px">LC_TIME=en_GB.ISO8859-15<br />
TZ=GB</pre>I have tried it on a different server with exactly the same commands and env variables and get the correct result, what am I doing wrong here?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>chris5126</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread212465.html</guid>
		</item>
		<item>
			<title>write data in file in unix</title>
			<link>http://www.daniweb.com/forums/thread210437.html</link>
			<pubDate>Mon, 10 Aug 2009 13:58:48 GMT</pubDate>
			<description><![CDATA[hai dani, 
 
 
pls anyone help me how to add data into filename 
actually i tried like this: 
$str|cat >> EmpFile 
 
for the above statement im not able to do coz even $str is also  
considere as command. 
how to insert the value?]]></description>
			<content:encoded><![CDATA[<div>hai dani,<br />
<br />
<br />
pls anyone help me how to add data into filename<br />
actually i tried like this:<br />
$str|cat &gt;&gt; EmpFile<br />
<br />
for the above statement im not able to do coz even $str is also <br />
considere as command.<br />
how to insert the value?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum113.html">Shell Scripting</category>
			<dc:creator>karpaklu</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread210437.html</guid>
		</item>
	</channel>
</rss>
