parsing text

Y

yang__lee

Hi,

I hope you may help me.

Please check the attached text file.
Actually its a report file with some headers information
and them report is in tabular format. I want to parse each row
and get the values.

I think strtok won't work here.

There are no tabs in between the column values they are spaces.
Column values them selves contain spaces but they are single spaces.
Minimum two spaces are there between column values.

can you suggest some algorithm in C or any other method to get each
column value.



In excel I try to create a delimited file but its unsuccessful. How to
do it in excel.

Thanks,

lee


following content is in a text file. Copy in a text file
Keep wordwrap off
-------------------------------------------------------------------------------




DATE: 04/07/2007

TMK

MTC_PROC REPORT

Area: KTO
WRKPCK: KTO


PROCESS PNAME FEANAME CEB MCO DPNUM NM_ITM
ERROR
TXT_GUI ERROID
_______ ___________ _____________ ___ ___ ______ __________
________________________________________________
____________________________________________________________ ______

RECKKON 206 DEVICE 007 997 532533 532533
Invalid source. BREAK needed. Count: 1501-1505
Source: -98 0201

RECKKON U206 DEVICE 007 997 532533 532533
Invalid source. BREAK needed. Count:
1421,1726-1730 Source: -98 0201

RECKKON F77 CROSS CNNCT 009 997 520624 520624
Feeder feature. Count: AM992,651-900
Source: 520619 7310

RECKKON F1727 X-MIC 009 997 521184 521184
Sourced Out. Count: SA5211,1-1800
Source: 0 0206

RECKKON F115 CROSS CNNCT 009 997 522306 522306
provide feed. Count:
1400,1001-1100 Source: 522333 7310
 
J

Jim Rech

When you open a text file in Excel the Text Import Wizard should pop up and
walk you through the process. The file is not delimited and I cannot tell
if it's fixed width but that is the option you'll have to try. Use the
wizard to indicate where the columns fall. If that does not result in a
satisfactory result you'll have to write a macro or use an external process.

As for saving a delimited file you might try File, Save As, CSV.

--
Jim
| Hi,
|
| I hope you may help me.
|
| Please check the attached text file.
| Actually its a report file with some headers information
| and them report is in tabular format. I want to parse each row
| and get the values.
|
| I think strtok won't work here.
|
| There are no tabs in between the column values they are spaces.
| Column values them selves contain spaces but they are single spaces.
| Minimum two spaces are there between column values.
|
| can you suggest some algorithm in C or any other method to get each
| column value.
|
|
|
| In excel I try to create a delimited file but its unsuccessful. How to
| do it in excel.
|
| Thanks,
|
| lee
|
|
| following content is in a text file. Copy in a text file
| Keep wordwrap off
| -------------------------------------------------------------------------------
|
|
|
|
| DATE: 04/07/2007
|
| TMK
|
| MTC_PROC REPORT
|
| Area: KTO
| WRKPCK: KTO
|
|
| PROCESS PNAME FEANAME CEB MCO DPNUM NM_ITM
| ERROR
| TXT_GUI ERROID
| _______ ___________ _____________ ___ ___ ______ __________
| ________________________________________________
| ____________________________________________________________ ______
|
| RECKKON 206 DEVICE 007 997 532533 532533
| Invalid source. BREAK needed. Count: 1501-1505
| Source: -98 0201
|
| RECKKON U206 DEVICE 007 997 532533 532533
| Invalid source. BREAK needed. Count:
| 1421,1726-1730 Source: -98 0201
|
| RECKKON F77 CROSS CNNCT 009 997 520624 520624
| Feeder feature. Count: AM992,651-900
| Source: 520619 7310
|
| RECKKON F1727 X-MIC 009 997 521184 521184
| Sourced Out. Count: SA5211,1-1800
| Source: 0 0206
|
| RECKKON F115 CROSS CNNCT 009 997 522306 522306
| provide feed. Count:
| 1400,1001-1100 Source: 522333 7310
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top