Re: [go-nuts] Need to read file in double loop

2021-01-12 Thread Tong Sun
Ops. sorry, it is. Wonder why it wasn't working before (tried at least twice).

On Tue, Jan 12, 2021 at 3:12 PM Tong Sun  wrote:
>
> That's a typo. Changing it to "E" you'd think the problem is solved?
>
> On Mon, Jan 11, 2021 at 10:14 PM Kurtis Rader  wrote:
> >
> > You should start by asking yourself why your program outputs "1", "2" and 
> > "S". Hint: after seeing "S" you don't break out of the inner loop until 
> > another "S" is seen which your sample data does not include.
> >
> > On Mon, Jan 11, 2021 at 6:59 PM Tong Sun  wrote:
> >>
> >> Hi,
> >>
> >> I need to read file in double loop --
> >>
> >> - reading file line by line until a special KW is met, say "S"
> >> - When it happens, need to collect content line by line until another 
> >> special KW is met, say "E"
> >>
> >> For e.g., if processing the following content line by line, then the 
> >> content from S 3 till 6 E need to be processed as a *single group*:
> >>
> >> 1
> >> 2
> >> S
> >> 3
> >> 4
> >> 5
> >> 6
> >> E
> >> 7
> >> 8
> >> 9
> >>
> >> How can I do that?
> >>
> >> I've prepared a starter
> >> https://play.golang.org/p/brdLtyjt-L2
> >>
> >> but it is not working as I expected
> >>
> >> Why 7 8 9 are not processed?
> >> How to fix it?
> >>
> >> Thx!
> >>
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "golang-nuts" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to golang-nuts+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/golang-nuts/db7e8fee-11f7-4e7a-8743-c6e3096342e4n%40googlegroups.com.
> >
> >
> >
> > --
> > Kurtis Rader
> > Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMmz1OcOEc9YFV-B6SDqVfJ951%3Do2Jbb5zXUejWvL8q4ZYqOiw%40mail.gmail.com.


Re: [go-nuts] Need to read file in double loop

2021-01-12 Thread Tong Sun
That's a typo. Changing it to "E" you'd think the problem is solved?

On Mon, Jan 11, 2021 at 10:14 PM Kurtis Rader  wrote:
>
> You should start by asking yourself why your program outputs "1", "2" and 
> "S". Hint: after seeing "S" you don't break out of the inner loop until 
> another "S" is seen which your sample data does not include.
>
> On Mon, Jan 11, 2021 at 6:59 PM Tong Sun  wrote:
>>
>> Hi,
>>
>> I need to read file in double loop --
>>
>> - reading file line by line until a special KW is met, say "S"
>> - When it happens, need to collect content line by line until another 
>> special KW is met, say "E"
>>
>> For e.g., if processing the following content line by line, then the content 
>> from S 3 till 6 E need to be processed as a *single group*:
>>
>> 1
>> 2
>> S
>> 3
>> 4
>> 5
>> 6
>> E
>> 7
>> 8
>> 9
>>
>> How can I do that?
>>
>> I've prepared a starter
>> https://play.golang.org/p/brdLtyjt-L2
>>
>> but it is not working as I expected
>>
>> Why 7 8 9 are not processed?
>> How to fix it?
>>
>> Thx!
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/db7e8fee-11f7-4e7a-8743-c6e3096342e4n%40googlegroups.com.
>
>
>
> --
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAMmz1OcPqgRv1kiByABSn6QZuSg_%3D6Ee4Yg186R8V396yyno4g%40mail.gmail.com.


Re: [go-nuts] Need to read file in double loop

2021-01-11 Thread Kurtis Rader
You should start by asking yourself why your program outputs "1", "2" and
"S". Hint: after seeing "S" you don't break out of the inner loop until
another "S" is seen which your sample data does not include.

On Mon, Jan 11, 2021 at 6:59 PM Tong Sun  wrote:

> Hi,
>
> I need to read file in double loop --
>
> - reading file line by line until a special KW is met, say "S"
> - When it happens, need to collect content line by line until another
> special KW is met, say "E"
>
> For e.g., if processing the following content line by line, then
> the content from S 3 till 6 E need to be processed as a *single group*:
>
> 1
> 2
> S
> 3
> 4
> 5
> 6
> E
> 7
> 8
> 9
>
> How can I do that?
>
> I've prepared a starter
> https://play.golang.org/p/brdLtyjt-L2
>
> but it is not working as I expected
>
> Why 7 8 9 are not processed?
> How to fix it?
>
> Thx!
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/db7e8fee-11f7-4e7a-8743-c6e3096342e4n%40googlegroups.com
> 
> .
>


-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD_oYHhikzFGBT1csDnThVPTDsudi0NL%2BWZ1PQv7Jb1zhQ%40mail.gmail.com.


[go-nuts] Need to read file in double loop

2021-01-11 Thread Tong Sun
Hi, 

I need to read file in double loop -- 

- reading file line by line until a special KW is met, say "S"
- When it happens, need to collect content line by line until another 
special KW is met, say "E"

For e.g., if processing the following content line by line, then 
the content from S 3 till 6 E need to be processed as a *single group*:

1
2
S
3
4
5
6
E
7
8
9

How can I do that?

I've prepared a starter
https://play.golang.org/p/brdLtyjt-L2

but it is not working as I expected

Why 7 8 9 are not processed?
How to fix it?

Thx!


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/db7e8fee-11f7-4e7a-8743-c6e3096342e4n%40googlegroups.com.