Re: Read block of file in Tcl
- From: Arjen Markus <arjen.markus@xxxxxxxxxx>
- Date: Thu, 26 May 2005 08:57:34 +0200
calvin hobbes wrote:
>
> Hi,
>
> I have an input file in the following format:
> ********************************
> Name1
> Name2
> Row1 DEF 001
> Row2 ABC DEG 003
> Row3 EW EW 002
> Row4 FF 0012
> Row1 ADEF 1001
> Row2 ARBC DEG 2003
> Row3 EWW EW 0302
> Row4 AB 0112
> Name1
> Name2
> Row1 DSDEF 001
> Row2 ABVC DEG 003
> Row3 EDW EW 002
> Row4 FVF 0012
> Row1 AF 1001
> Row2 ACRBC DEG 2003
> Row3 ESWW EW 0302
> Row4 AEB 0112
> ****************************************
> I have to read this file and
> --> if I get "Name1" in any of the line,
> then I have to read the block of file from "Name1" to the first
> occurrance
> of "Row4".
> --> If I get "Row1" after the above reading is done, then I have to
> read
> the block of file from "Row1" to the first occurrance of "Row4".
>
> Can anyone help me out in doing this through TCL.
>
> Thanks and regards,
> Calvin
You question has the characteristics of a homework assignment.
Just a few hints:
- [gets] lets you read a file line by line
- the while loop may prove useful
Regards,
Arjen
.
- Follow-Ups:
- Re: Read block of file in Tcl
- From: nottycalvin
- Re: Read block of file in Tcl
- References:
- Read block of file in Tcl
- From: calvin hobbes
- Read block of file in Tcl
- Prev by Date: Read block of file in Tcl
- Next by Date: crash in TclExecuteByteCode
- Previous by thread: Read block of file in Tcl
- Next by thread: Re: Read block of file in Tcl
- Index(es):
Relevant Pages
|
|