Sponsored Content
Full Discussion: Text to CSV
Top Forums Shell Programming and Scripting Text to CSV Post 302350153 by shantanuo on Thursday 3rd of September 2009 01:16:35 AM
Old 09-03-2009
Text to CSV

Hi,
My access log looks like this...

Code:
 192.168.50.184 - - [31/Aug/2009:11:56:59 +0530] "GET /ATIM_LATEST/ABC/ HTTP/1.1" 200 522 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13" 
192.168.50.184 - - [31/Aug/2009:11:56:59 +0530] "GET /ATIM_LATEST/ABC/ATIM/syncdepot.php HTTP/1.1" 200 1463 "http://192.168.50.209/ATIM_LATEST/ABC/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13"
192.168.50.184 - - [31/Aug/2009:11:56:59 +0530] "GET /ATIM_LATEST/ABC/js/ajax.js HTTP/1.1" 200 2623 "http://192.168.50.209/ATIM_LATEST/ABC/ATIM/syncdepot.php" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13"

I want to insert the data in MySQL
1) Is there any script that will do it automatically.
2) If no, then How do I convert the format to either comma separated text file or fields delimited by " "?

For e.g.

Code:
 192.168.50.184, -, -, [31/Aug/2009:11:56:59 +0530], "GET /ATIM_LATEST/ABC/ATIM/syncdepot.php HTTP/1.1", 200, 1463, "http://192.168.50.209/ATIM_LATEST/ABC/", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13"

OR

Code:
 "192.168.50.184" "-" "-" "[31/Aug/2009:11:56:59 +0530]" "GET /ATIM_LATEST/ABC/ATIM/syncdepot.php HTTP/1.1" "200" "1463" "http://192.168.50.209/ATIM_LATEST/ABC/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.13) Gecko/2009073022 Firefox/3.0.13"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

converting text to csv format

I am trying to check each line and based on first two digits, the comma needs to be place. I checked in the earlier post where the text is converted to csv with a tab delimited. Here is the test file that needs to be changed to csv 11 051701 22 051701 330123405170105170112345... (13 Replies)
Discussion started by: gthokala
13 Replies

2. UNIX for Advanced & Expert Users

how to convert text/csv to excel

Hello All, I have a sql report with 50 columns and 1000 rows result in a file ( txt / csv). is there is any way that we can move them to excel in KSH. Thanks, Sateesh (7 Replies)
Discussion started by: kotasateesh
7 Replies

3. Shell Programming and Scripting

Text to csv

Hi, I have a document with a lot of data, it is structured like this, UNIQUESTRING To be acquited of a crime is to be deemed to be innocent of the charges after a court hearing. This is different from a <a href=lawglos_Discharge.html>Discharge</a>, where the case is never heard. In... (1 Reply)
Discussion started by: lawstudent
1 Replies

4. Shell Programming and Scripting

Can't use Text::CSV... any sample code out there?

I was looking at a library that lets me parse comma delimited csv files without a problem, but unfortunately, I'm not allowed to make use of that library. I understand that the library probably does something similar to a string split(), but I don't quite know what kind of regular expression is... (1 Reply)
Discussion started by: mrwatkin
1 Replies

5. Shell Programming and Scripting

text to csv conversion

Thank u every body ......just need a help so that a text file needs to be converted into CSV............. my log file is as follows Host scsi3: usb-storage Vendor: Maxtor Product: OneTouch III Serial Number: 044303E5 Protocol: Transparent SCSI Transport: Bulk ... (4 Replies)
Discussion started by: tangotango
4 Replies

6. Shell Programming and Scripting

Convert text to CSV

Hi Gurus I need urgent help to convert a flat log file into csv format to load into database. Log looks like: a=1 b=2 c=3 a=4 b=5 c=6 Only the values at right side of = will come into csv and it should create a new line once it receives "a" field. (8 Replies)
Discussion started by: sandipjee
8 Replies

7. Shell Programming and Scripting

TEXT to CSV using Perl

Hi Folks Need some help with this and my Perl isnt the hottest I also have text::csv installed on my perl install The large text with a few million entries is in a format below example text file Fig Leafs Cake No: 0000001 Author: King s. Record No: 995-34343-232-232... (5 Replies)
Discussion started by: messiah1
5 Replies

8. Shell Programming and Scripting

Create csv from text file

Gents, I am trying to create a csv file using the file attached. I have a problem to get all information required because the rows are not continues. Here is my code till now. awk ' /"ffid"/{if(s){print s;s=$NF}else{s=$NF}} /"LineNumber"/{s=s $NF} /"PointNumber"/{s=s $NF}... (4 Replies)
Discussion started by: jiam912
4 Replies

9. Shell Programming and Scripting

CSV from Text file

Gents, Attached there is a input.txt and code.txt file. I use that code to create a csv file from txt file. Is there the possibility to generate other code more faster to generate the CVS file using the input file. I have deleted many data in the input file to avoid load a lot data. ... (10 Replies)
Discussion started by: jiam912
10 Replies

10. Shell Programming and Scripting

Convert text to csv

Hi, Is there somebody there to post an idea on how to convert this 5 liner row to 1 liner or tab delimiter to be import to database. Here the text file format: Description: Description1 Link: https://www.google.com Date: June 2, 2018 Time: 00:07:44 Age: 1 days ago Description:... (2 Replies)
Discussion started by: lxdorney
2 Replies
FINDSMB(1)							   User Commands							FINDSMB(1)

NAME
findsmb - list info about machines that respond to SMB name queries on a subnet SYNOPSIS
findsmb [subnet broadcast address] DESCRIPTION
This perl script is part of the samba(7) suite. findsmb is a perl script that prints out several pieces of information about machines on a subnet that respond to SMB name query requests. It uses nmblookup(1) and smbclient(1) to obtain this information. OPTIONS
-r Controls whether findsmb takes bugs in Windows95 into account when trying to find a Netbios name registered of the remote machine. This option is disabled by default because it is specific to Windows 95 and Windows 95 machines only. If set, nmblookup(1) will be called with -B option. subnet broadcast address Without this option, findsmb will probe the subnet of the machine where findsmb(1) is run. This value is passed to nmblookup(1) as part of the -B option. EXAMPLES
The output of findsmb lists the following information for all machines that respond to the initial nmblookup for any name: IP address, NetBIOS name, Workgroup name, operating system, and SMB server version. There will be a '+' in front of the workgroup name for machines that are local master browsers for that workgroup. There will be an '*' in front of the workgroup name for machines that are the domain master browser for that workgroup. Machines that are running Windows for Workgroups, Windows 95 or Windows 98 will not show any information about the operating system or server version. The command with -r option must be run on a system without nmbd(8) running. If nmbd is running on the system, you will only get the IP address and the DNS name of the machine. To get proper responses from Windows 95 and Windows 98 machines, the command must be run as root and with -r option on a machine without nmbd running. For example, running findsmb without -r option set would yield output similar to the following IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION --------------------------------------------------------------------- 192.168.35.10 MINESET-TEST1 [DMVENGR] 192.168.35.55 LINUXBOX *[MYGROUP] [Unix] [Samba 2.0.6] 192.168.35.56 HERBNT2 [HERB-NT] 192.168.35.63 GANDALF [MVENGR] [Unix] [Samba 2.0.5a for IRIX] 192.168.35.65 SAUNA [WORKGROUP] [Unix] [Samba 1.9.18p10] 192.168.35.71 FROGSTAR [ENGR] [Unix] [Samba 2.0.0 for IRIX] 192.168.35.78 HERBDHCP1 +[HERB] 192.168.35.88 SCNT2 +[MVENGR] [Windows NT 4.0] [NT LAN Manager 4.0] 192.168.35.93 FROGSTAR-PC [MVENGR] [Windows 5.0] [Windows 2000 LAN Manager] 192.168.35.97 HERBNT1 *[HERB-NT] [Windows NT 4.0] [NT LAN Manager 4.0] VERSION
This man page is correct for version 3 of the Samba suite. SEE ALSO
nmbd(8), smbclient(1), and nmblookup(1) AUTHOR
The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed by the Samba Team as an Open Source project similar to the way the Linux kernel is developed. The original Samba man pages were written by Karl Auer. The man page sources were converted to YODL format (another excellent piece of Open Source software, available at ftp://ftp.icce.rug.nl/pub/unix/) and updated for the Samba 2.0 release by Jeremy Allison. The conversion to DocBook for Samba 2.2 was done by Gerald Carter. The conversion to DocBook XML 4.2 for Samba 3.0 was done by Alexander Bokovoy. Samba 3.5 06/18/2010 FINDSMB(1)
All times are GMT -4. The time now is 07:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy