It's a terrible thing to forget the simple things..... 
Author Message
 It's a terrible thing to forget the simple things.....

I used to use awk often, but haven't used it in almost 2 yrs.  I have
a file that I'm trying to parse, and I'm trying to build the script
slowly.....

And it won't work, what am I missing?

{
 $line_size = 5;
 $record = "";
 print $line_size;
 for ($i=0; $i<$line_size; $i++)
 {
   $record = $record + "0";
 }
 print $record;

Quote:
}

Thanks,
Brian


Mon, 05 Jan 2004 22:22:27 GMT  
 It's a terrible thing to forget the simple things.....

Quote:

> I used to use awk often, but haven't used it in almost 2 yrs.  I have
> a file that I'm trying to parse, and I'm trying to build the script
> slowly.....

> And it won't work, what am I missing?

> {
>  $line_size = 5;
>  $record = "";
>  print $line_size;
>  for ($i=0; $i<$line_size; $i++)
>  {
>    $record = $record + "0";
>  }
>  print $record;
> }

> Thanks,

dunno what's it's supposed to do, but..........
what's the "record" ?

{
 line_size = 5;
 record = "";
 print line_size;
 for (i=0; i<line_size; i++)
 {
 #record = record + "0";
 }
 print record;

- Show quoted text -

Quote:
}
> Brian



Tue, 06 Jan 2004 00:37:02 GMT  
 It's a terrible thing to forget the simple things.....

Quote:

>I used to use awk often, but haven't used it in almost 2 yrs.  I have
>a file that I'm trying to parse, and I'm trying to build the script
>slowly.....

>And it won't work, what am I missing?

>{
> $line_size = 5;
> $record = "";
> print $line_size;
> for ($i=0; $i<$line_size; $i++)
> {
>   $record = $record + "0";
> }
> print $record;
>}

Looks fine to me, a little convoluted, but then again, that often happens.

The following is equivalent, and a bit shorter:

{ print "\n0" }



Wed, 07 Jan 2004 09:15:25 GMT  
 It's a terrible thing to forget the simple things.....


Quote:
> And it won't work, what am I missing?

> {
>  $line_size = 5;
>  $record = "";
>  print $line_size;
>  for ($i=0; $i<$line_size; $i++)
>  {
>    $record = $record + "0";
>  }
>  print $record;
> }

This code is same as:
{
  $0 = 5; #your record overwrited(Because line_size=0 - not assign ....)
  $0 = ""; #your record overwrited again
  print ""; #Nothing
  for ($0=0; $0<$0; $i++)  #Never
  {
    $record = $record + "0";
  }
  print 0; # Your output must bee 0 for every line
 }
ciao
camil


Thu, 08 Jan 2004 06:05:44 GMT  
 It's a terrible thing to forget the simple things.....

Quote:
> I used to use awk often, but haven't used it in almost 2 yrs.  I have
> a file that I'm trying to parse, and I'm trying to build the script
> slowly.....

> And it won't work, what am I missing?

Mainly the fact that awk isn't perl!

Quote:
> {
>  $line_size = 5;
>  $record = "";
>  print $line_size;
>  for ($i=0; $i<$line_size; $i++)
>  {
>    $record = $record + "0";
>  }
>  print $record;
> }

> Thanks,
> Brian

No need for "$" in front of your variables or the semicolons (except in the
"for").  Also note that without some input your program won't do anything
much.

What are you trying to achieve?  If you tell us more we may be able to help.

HTH
--


Opinions expressed are my own and not necessarily those of my employer



Fri, 09 Jan 2004 16:07:32 GMT  
 It's a terrible thing to forget the simple things.....
I'd say to review your AWK grammar.  AWK variables don't start with
'$', except for field refrences.  The code you posted looks more like
Perl...


Mon, 12 Jan 2004 03:42:10 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. gcc inline asm, can't do even simple things :-(

2. SIMPLE THINGS that don't work in Tk

3. opps...another thing I forgot!

4. opps...another thing I forgot!

5. opps...another thing I forgot!

6. opps...another thing I forgot!

7. valueNowOrOnUnwindDo: (forgot one more thing)

8. Could someone help with a very simple thing?

9. What should be a simple thing?

10. Simple things

11. Doing the simplest thing with Tkinter Canvas

12. Seemingly simple problem with adding things to a canvas

 

 
Powered by phpBB® Forum Software