Data parsing from txt files to one excel file

navin

New Member
Joined
Sep 23, 2010
Messages
1
Dear Expert,


I want to import data from a folder having different txt/log files say 1.txt , 2.txt , 3.txt to one excel workbook having predefined sheets ,one for every .txt file by pressing one IMPORT tab.



Data imported from txt file should be based on key words.

Like in txt file there is one word date , this should be matched to perfectly one cell in excel sheet and so on.(plz refer below , data to be fetched is marked as yellow)

there is 2 lines of numeric data in txt file that should be imported in tabular form in excel after the word counter and date in the form

Same is to repeat for say 10 files .

please help me in coding for one txt file , i will try to do it for rest of the files.



I will be very grateful for ur help.

Regards,
Navin








txt file to be read is like this




MGWP102> pmx MgwApplication maxNrOfLicMediaStreamChannels -m 2

110201-09:34:58 10.200.67.60 8.0d MGW_NODE_MODEL_B_15_21 stopfile=/tmp/28134
.........................

gzip -dc /home/mtr/moshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm_data/A20110201.0200-0215.1.xml.gz /home/mtr/moshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm
_data/A20110201.0215-0230.1.xml.gz /home/mtr/moshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm_data/A20110201.0230-0245.1.xml.gz /home/mtr/moshell_logfiles/logs_moshe
ll/pmfiles/10.200.67.60/pm_data/A20110201.0245-0300.1.xml.gz /home/mtr/moshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm_data/A20110201.0300-0315.1.xml.gz /home/mtr/m
oshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm_data/A20110201.0315-0330.1.xml.gz /home/mtr/moshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm_data/A20110201.0330
-0345.1.xml.gz /home/mtr/moshell_logfiles/logs_moshell/pmfiles/10.200.67.60/pm_data/A20110201.0345-0400.1.xml.gz | /home/mtr/moshell//pmExtract -u "mgwapplication" "maxNr
OfLicMediaStreamChannels" | /home/mtr/moshell//pmXtab -cols time -fmt txt -m "(?:\w+=[^,]+,){1,2}((\w+=[^,]+,*)+$)"

Report from 2011-02-01 02:00 UTC to 2011-02-01 03:59 UTC

Date: 2011-02-01
Object Counter 02:00 02:15 02:30 02:45 03:00 03:15 03:30 03:45
MgwApplication=1 maxNrOfLicMediaStreamChannels 57744 57744 57744 57744 57744 57744 57744 57744
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top