Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > Bash script tim...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 2105 of 2317
Post > Topic >>

Bash script timing out

by cozzmo1@[EMAIL PROTECTED] Dec 19, 2007 at 10:47 AM

Perhaps someone could help with this.
This script times out.


#!/bin/bash
cat ~/$1 |  while  read line
do
if [[ "$line" != /*/*/**Closed* && "$line" != "" &&  "$line" != *Auto?
Closed* ]]
 then
{
if [[ "$line" == [1-6][0-9][0-9][0-9][0-9]\,*[a-z,A-Z]* ]]
then
{
read ticket date time <<EOF
$(echo "$line" | nawk 'BEGIN { FS = "," } ; { print  $1,  $6, $7 }')
EOF
echo "$ticket" "$date" "$time" "Opened"
}
elif [[  "$line" == \*\*\**Not?Approved* ]]
then
{
echo "$line" | nawk '{ print "$ticket" " " $4 " " $5 " " "Not-
Approved" }'
}
elif [[  "$line" ==  \*\*\**Picked?Up* || "$line" == \*\*\**Complete*
|| "$line" == \*\*\**Approved*  ]]
then
{
echo "$ticket" "$line" | nawk '{ print $1 " " $5 " " $6 " " $8 }'
}
fi
}
fi
done

---------
Output:  (note yak1 is a very huge file, and I am just trying to get
the facts out.)

$ temp2 yak1
<snip>
32626 2007-09-26 10:57:00 Opened
32626 09-26-2007 12:23 Picked
32626 09-26-2007 12:47 Approved
32626 09-27-2007 01:51 Complete
32627 2007-09-26 11:16:00 Opened
32627 09-26-2007 11:30 Picked
32627 09-26-2007 11:30 Approved
32627 09-26-2007 11:41 Complete
32628 2007-09-26 11:20:00 Opened
32628 09-26-2007 11:29 Picked
32628 09-26-2007 11:29 Approved
32628 09-26-2007 11:46 Complete
<output ends here>
but the file hasn't even been half parsed, if I pipe this to a file,
then it ends sooner (32635).

This seems to have started after I added these items in order to print
from the variables instead of just rendering straight to print.
read ticket date time <<EOF
EOF
echo "$ticket" "$date" "$time" "Opened"

I am sure it has nothing to do with the input file.
but don't know why it hangs.
maybe there is a buffer that fills up because of the variables??

Thanks,
crzzy1
 




 7 Posts in Topic:
Bash script timing out
cozzmo1@[EMAIL PROTECTED]  2007-12-19 10:47:04 
Re: Bash script timing out
Kees Nuyt <k.nuyt@[EMA  2007-12-19 21:19:12 
Re: Bash script timing out
Ed Morton <morton@[EMA  2007-12-19 17:44:46 
Re: Bash script timing out
cozzmo1@[EMAIL PROTECTED]  2007-12-21 08:54:47 
Re: Bash script timing out
Ed Morton <morton@[EMA  2007-12-21 12:34:46 
Re: Bash script timing out
cozzmo1@[EMAIL PROTECTED]  2008-01-03 08:23:56 
Re: Bash script timing out
Ed Morton <morton@[EMA  2008-01-03 18:27:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:00:07 CDT 2008.