Sponsored Content
Top Forums Programming awk script to convert a text file into csv format Post 302453320 by certteam on Tuesday 14th of September 2010 11:53:48 PM
Old 09-15-2010
awk script to convert a text file into csv format

hi...... thanks for allowing me to start a discussion
i am collecting usb usage details of all users and convert it into csv files so that i can export it into some database..
the input text file is as follows:-
Code:
USB History Dump
by nabiy (c)2008 
(1) --- Kingston DataTraveler 130 USB Device 
instanceID: 0018F3D974B4A9C0E1760896&0
ParentIdPrefix:  7&b62e00e&2
Last Mounted As:  \DosDevices\I:
Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0033
Disk  Stamp: 09/07/2010 15:07
Volume Stamp: 09/07/2010 15:07 
(2) --- Kingston DataTraveler 2.0 USB Device 
instanceID: 001D0F1E35B25B8C1201011B&0
ParentIdPrefix:  7&1f5848f3&0
Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0035
Disk  Stamp: 09/06/2010 15:18
Volume Stamp: 09/06/2010 15:18 
(3) --- Maxtor OneTouch III USB Device 
instanceID: 044303E5&0
ParentIdPrefix:  
Driver:{4D36E967-E325-11CE-BFC1-08002BE10318}\0032
Disk Stamp: 09/10/2010  10:09
Volume Stamp: 03/12/2010 10:42

how can i parse this file so that i can get in following format
Code:
hostname Devic_name instanceID ParentPrefix LastMountedAs Driver 
pcname       kingston         xxxx            xxxxxxxxx        xxxxxxxxxx  xxxxxxxx
pcname       maxtor     0440xxx 4            d 367          08/07/2010  xxxxxxxx
pcname         kingston        xxxxxxx            xxxxxxx         xxxxxxxxx     xxxxxxxx

the pc name will be take from hostname command

the output desirable is in csv format for database with some batch or awk script........
any suggestion in this regard is greatly appreciated
thanks in advance/.........

Last edited by Franklin52; 09-15-2010 at 02:53 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Convert a csv file to an xls format

Hi, I have a file coming in xxx.txt(csv format) i do some work on it and i need to send out as a .xls format. Is there any way there is some code i can use in my script to convert this? I'm struggling on this. Thanks (11 Replies)
Discussion started by: Pablo_beezo
11 Replies

2. UNIX for Dummies Questions & Answers

Unix script to convert .csv file to.xls format

I have a .csv file in Unix box i need a UNIX script to convert the.csv files to.xls format. Its very urgent please help me. (1 Reply)
Discussion started by: moon_friend
1 Replies

3. Programming

convert text file to csv

hi all, i have a select query that gives me the output in the following way... SYSTYPE -------------------------------------------------------------------------------- Success Failures Total RFT ---------- ---------- ---------- ---------- TYP 1 0 ... (3 Replies)
Discussion started by: sais
3 Replies

4. Shell Programming and Scripting

Is there any script which convert binary file to CSV format

Dear guys; I have a binary file and I need to convert its data to csv format ...appreciating your help. Best Regards (14 Replies)
Discussion started by: ahmad.diab
14 Replies

5. Shell Programming and Scripting

Convert the below file to csv format

Hi , i want to change this question, i will post soon.. (6 Replies)
Discussion started by: srikanth2567
6 Replies

6. Shell Programming and Scripting

Format text to bold from perl script to csv

Hi everyone, is there any way in perl using which we can print the selective words in bold when we write the output to a csv file? Please find the example below 1. Filename: A 2. name age 12 3. city add 23 Line1 should only be bold. Outputs from other files being read in the... (2 Replies)
Discussion started by: ramakanth_burra
2 Replies

7. Shell Programming and Scripting

Need a unix script to convert date into Julian format in a text file

The 6th & 7th column of the text files represents date & time. I need this to be converted in julian format using command "date +%s -d <date>". I know the command, but dont know how to use it on the script 0 dbclstr-b IXT_Web Memphis_Prod_SQL_Full Memphis-Prod-SQL-Full-Application-Backup... (4 Replies)
Discussion started by: ajiwww
4 Replies

8. Shell Programming and Scripting

Awk to convert a text file to CSV file with some string manipulation

Hi , I have a simple text file with contents as below: 12345678900 971,76 4234560890 22345678900 5971,72 5234560990 32345678900 71,12 6234560190 the new csv-file should be like: Column1;Column2;Column3;Column4;Column5 123456;78900;971,76;423456;0890... (9 Replies)
Discussion started by: FreddyDaKing
9 Replies

9. Shell Programming and Scripting

Trying extract from text file and convert csv

I want to extract IP address, system ID and engine IDs of this file ( marked in red) and put in a csv. E.g. 1.1.1.1, SYSTEMID, 000012345678981123548912 I get these file by running an expect script from solaris. Here is the text file output of my expect script. working on 1.1.1.1 SNMP... (5 Replies)
Discussion started by: pbshillong
5 Replies

10. Shell Programming and Scripting

Need to Preprocess a text file and convert into csv

Hello, I was working with Machine learning and would like to apply my regression algorithms on binary classification datasets. So I came across this adult dataset, LIBSVM Data: Classification (Binary Class) It is a binary dataset, features have values only 1 and 0. and I wanted to... (4 Replies)
Discussion started by: ajayram
4 Replies
GLDRAWELEMENTSINSTAN(3G)					    OpenGL 3.3						  GLDRAWELEMENTSINSTAN(3G)

NAME
glDrawElementsInstanced - draw multiple instances of a set of elements C SPECIFICATION
void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount); PARAMETERS
mode Specifies what kind of primitives to render. Symbolic constants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES, GL_TRIANGLE_STRIP_ADJACENCY and GL_TRIANGLES_ADJACENCY are accepted. count Specifies the number of elements to be rendered. type Specifies the type of the values in indices. Must be one of GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT. indices Specifies a pointer to the location where the indices are stored. primcount Specifies the number of instances of the specified range of indices to be rendered. DESCRIPTION
glDrawElementsInstanced behaves identically to glDrawElements() except that primcount instances of the set of elements are executed and the value of the internal counter instanceID advances for each iteration. instanceID is an internal 32-bit integer counter that may be read by a vertex shader as gl_InstanceID. glDrawElementsInstanced has the same effect as: if (mode, count, or type is invalid ) generate appropriate error else { for (int i = 0; i < primcount ; i++) { instanceID = i; glDrawElements(mode, count, type, indices); } instanceID = 0; } NOTES
glDrawElementsInstanced is available only if the GL version is 3.1 or greater. GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP_ADJACENCY and GL_TRIANGLES_ADJACENCY are available only if the GL version is 3.2 or greater. ERRORS
GL_INVALID_ENUM is generated if mode is not one of GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, or GL_TRIANGLES. GL_INVALID_VALUE is generated if count or primcount are negative. GL_INVALID_OPERATION is generated if a geometry shader is active and mode is incompatible with the input primitive type of the geometry shader in the currently installed program object. GL_INVALID_OPERATION is generated if a non-zero buffer object name is bound to an enabled array and the buffer object's data store is currently mapped. SEE ALSO
glDrawElements(), glDrawArraysInstanced() COPYRIGHT
Copyright (C) 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/. OpenGL 3.3 03/08/2011 GLDRAWELEMENTSINSTAN(3G)
All times are GMT -4. The time now is 11:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy