473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Data Extraction from txt file

2
Dear Fellows,

I need to extract Month day time user and password from the log file provided below.

Expand|Select|Wrap|Line Numbers
  1. Aug 27 03:56:32 sktmail popper[12994]: (v4.0.Cool POP login by user "assad" PASS=assad 192.168.2.1 192.168.1.1 [pop_log.c:247]
  2. Aug 27 03:59:33 sktmail popper[13020]: (v4.0.Cool POP login by user "tariq" PASS=tariq 192.168.2.1 192.168.1.1 [pop_log.c:247]
  3. Aug 27 04:50:33 sktmail popper[13020]: (v4.0.Cool POP login by user "james" PASS=james 192.168.2.1 192.168.1.1 [pop_log.c:247]
  4.  
Aug 29 '07 #1
3 1982
Expand|Select|Wrap|Line Numbers
  1. open(FR,"sam.txt");
  2. print "\nMonth \t Date \t Time\n";
  3. while ($l = <FR>) {
  4.     @t = split(' ',$l);
  5.     print "$t[0] \t $t[1] \t $t[2]\n";
  6. }
  7. close(FR);
  8.  
sam.txt::
Expand|Select|Wrap|Line Numbers
  1. Aug 27 03:56:32 sktmail popper[12994]: (v4.0.Cool POP login by user "assad" PASS=assad 192.168.2.1 192.168.1.1 [pop_log.c:247]
  2. Aug 27 03:59:33 sktmail popper[13020]: (v4.0.Cool POP login by user "tariq" PASS=tariq 192.168.2.1 192.168.1.1 [pop_log.c:247]
  3. Aug 27 04:50:33 sktmail popper[13020]: (v4.0.Cool POP login by user "james" PASS=james 192.168.2.1 192.168.1.1 [pop_log.c:247]
  4.  
Aug 29 '07 #2
KevinADC
4,059 Expert 2GB
comments removed.............
Aug 29 '07 #3
numberwhun
3,509 Expert Mod 2GB
ganthimathi,

really. This is a learning forum. You, me, nor any of the others here are going to learn anything if code is just supplied at the posters request. This is NOT a code writing service. I personally learn by doing and don't want someone writing my whole program for me. Besides, there are a lot of homework questions that get posted here and again, doing it for them doesn't help them out. Please, make sure the user posts there code first and then troubleshoot it.

Also, if you post code, please use code tags. This does not consist of of the word "code:" before you write the code. For an example of code tags, please see the "REPLY GUIDELINES" next to the message window when posting.

Regards,

Jeff
Aug 29 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Kangol kangoll | last post by:
hi, i've been trying to figure out how to make visual basic start extracting text at a certain line to when i tell it to stop. I am making trying to make a program where it extracts text from a...
35
by: Troll | last post by:
Hi, I need to write a script which reads some data and reports the findings. Just to give you an idea the structure is similar to the following. Data input example: HEADING 1 **********...
7
by: Santah | last post by:
hi I'm new to C++ and I'm currently working on Visual C++ 6.0 I'm trying to open a text file, and read some data from it part of the text file looks like this: --------
8
by: Bruce Lee | last post by:
Hi I have the following 2 questions: 1.How to write binary data to a text file in C? I have a number like 10001010110001 say, I need to put it in the text file so that I can see the corresponding...
1
by: Jason Huang | last post by:
Hi, To make it short, how do we do the data extraction to MSWord using ASP.Net C#? Any help will be appreciated. Jason
2
by: Jason Huang | last post by:
Hi, Would someone show me how to do the data extraction to Excel in ASP.Net using C# web form? I am not familiar with VB, so I am asking someone to help me out! Any help will be appreciated. ...
9
by: Alex Buell | last post by:
I have a small text file which consist of the following data: ]] And the code I've written is as follows: ]] The trouble is, I can't work out why it goes into an infinite loop reading the...
1
by: Peter Thorne | last post by:
I am a perl newbie who is trying to write a script to automate a task. I have a large collection of compressed archives (mostly .tar.gz, tar.bz2, tar.Z, .tgz etc). This are stored in a number...
4
by: martin-g | last post by:
Hi. Now I'm working on a project one of the requirements of which is reading data from a PDF file into a table. I have googled quite a long, but couldn't find any appropriate method to do this....
16
by: EM.Bateman | last post by:
Working on Visual Studio .Net I've implemented a class: #ifndef CONTRIBUTOR_H #define CONTRIBUTOR_H enum Gender {male=1, female, unk}; #include <iostream> #include <iomanip> #include...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.