Visit Our UNIX and Linux User Community


Is there any script which convert binary file to CSV format


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Is there any script which convert binary file to CSV format
# 8  
Old 11-03-2009
How should we be able to help you. All you've told us yet is that you have that file and that you want to convert it to CSV. We don't know what format that file is in. We don't know where to look for the data you want, what kind of data that is, what format it is in. We don't know how much of that information you want in the CSV, or if there should be any transformations applied. We don't even know what you've tried so far, if any.

So, if you want our help, help yourself by giving us enough information so that we can understand your problem.
# 9  
Old 11-03-2009
Hi Ahmad, how about:
Code:
strings cdr_20091102155050_576591.bin|
awk 'NR>2{if(k==""){k=$1;rec=k} else{rec=rec","$1; if(k==$1){if(k!=p){k="";print rec}}} p=$1}'

Code:
21622727582,21622727582,962799607810,962799607810,rttrnk-gwmsc1,rtlist-gwmsc1,213.177.163.34,10.100.3.50,/83d7b75d28a98811bc6e62deeb3e4358@213.177.163.34,213.177.163.34,213.177.167.82,10.100.6.22,G729,G729,43868,49452,21622727582
213770980158,213770980158,962796737788,962796737788,rttrnk-gwmsc2,rtlist-gwmsc2,213.177.163.34,10.100.3.50,/f55d42f798bb2d23769ba27b5f8897c9@213.177.163.34,213.177.167.18,10.100.6.50,G729,52740,49328,213.177.163.34,213770980158
962785150116,962785150116,966555816513,966555816513,rttrnk-bt,rtlist-bt,962555816513,962795364491,10.100.3.50,194.88.66.181,*7b6d83e3-474b4fcf-2bed7545-25d@10.100.3.50,962555816513,962785150116
21623272448,21623272448,962799269490,962799269490,rttrnk-gwmsc1,rtlist-gwmsc1,213.177.163.34,10.100.3.50,/822f6d69e6fb7054a4b9d06ab50397c4@213.177.163.34,213.177.163.34,213.177.167.82,10.100.6.22,G729,G729,57300,49456,21623272448
249912279033,249912279033,249912010584,249912010584,rttrunk-sudan,rtlist-sudan,96249912010584,10.100.3.50,41.223.203.244,*2b06f487-342a99f3-53530cd2-25e@10.100.3.50,10.100.5.46,UNKNOWN,UNKNOWN,49262,249912279033
7088986757,7088986757,96264888716,96264888716,rttrnk-gwmsc2,rtlist-gwmsc2,216.53.4.5,10.100.3.50,Esbcsipuac.2_66.33.165.74_b09sb07_1_2009110209292117_1900037343_356308,66.33.165.73,10.100.6.50,G729,20038,49330,216.53.4.5,7088986757


Last edited by Scrutinizer; 11-03-2009 at 04:21 PM..
# 10  
Old 11-03-2009
Well here is the contents of the archive, how do you need it converted to csv format?

Code:
 MGC-CDR-PGW1A
9.5(2)
21622727582
21622727582
962799607810
962799607810
rttrnk-gwmsc1
rtlist-gwmsc1
213.177.163.34
10.100.3.50
/83d7b75d28a98811bc6e62deeb3e4358@213.177.163.34
213.177.163.34
213.177.167.82
10.100.6.22
G729
G729
43868
49452
21622727582
213770980158
213770980158
962796737788
962796737788
rttrnk-gwmsc2
rtlist-gwmsc2
213.177.163.34
10.100.3.50
/f55d42f798bb2d23769ba27b5f8897c9@213.177.163.34
213.177.167.18
10.100.6.50
G729
52740
49328
213.177.163.34
213770980158
962785150116
962785150116
966555816513
966555816513
 rttrnk-bt
 rtlist-bt
962555816513
962795364491
10.100.3.50
194.88.66.181
*7b6d83e3-474b4fcf-2bed7545-25d@10.100.3.50
962555816513
962785150116
21623272448
21623272448
962799269490
962799269490
rttrnk-gwmsc1
rtlist-gwmsc1
213.177.163.34
10.100.3.50
/822f6d69e6fb7054a4b9d06ab50397c4@213.177.163.34
213.177.163.34
213.177.167.82
10.100.6.22
G729
G729
57300
49456
21623272448
249912279033
249912279033
249912010584
249912010584
rttrunk-sudan
rtlist-sudan
96249912010584
10.100.3.50
41.223.203.244
*2b06f487-342a99f3-53530cd2-25e@10.100.3.50
10.100.5.46
UNKNOWN
UNKNOWN
49262
249912279033
7088986757
7088986757
96264888716
96264888716
rttrnk-gwmsc2
rtlist-gwmsc2
216.53.4.5
10.100.3.50
Esbcsipuac.2_66.33.165.74_b09sb07_1_2009110209292117_1900037343_356308
66.33.165.73
10.100.6.50
G729
20038
49330
216.53.4.5
7088986757
 MGC-CDR-PGW1A
9.5(2)

# 11  
Old 11-04-2009
Quote:
Originally Posted by steadyonabix
Well here is the contents of the archive, how do you need it converted to csv format?

Code:
 MGC-CDR-PGW1A
9.5(2)
21622727582
21622727582
962799607810
962799607810
rttrnk-gwmsc1
rtlist-gwmsc1
213.177.163.34
10.100.3.50
/83d7b75d28a98811bc6e62deeb3e4358@213.177.163.34
213.177.163.34
213.177.167.82
10.100.6.22
G729
G729
43868
49452
21622727582
213770980158
213770980158
962796737788
962796737788
rttrnk-gwmsc2
rtlist-gwmsc2
213.177.163.34
10.100.3.50
/f55d42f798bb2d23769ba27b5f8897c9@213.177.163.34
213.177.167.18
10.100.6.50
G729
52740
49328
213.177.163.34
213770980158
962785150116
962785150116
966555816513
966555816513
 rttrnk-bt
 rtlist-bt
962555816513
962795364491
10.100.3.50
194.88.66.181
*7b6d83e3-474b4fcf-2bed7545-25d@10.100.3.50
962555816513
962785150116
21623272448
21623272448
962799269490
962799269490
rttrnk-gwmsc1
rtlist-gwmsc1
213.177.163.34
10.100.3.50
/822f6d69e6fb7054a4b9d06ab50397c4@213.177.163.34
213.177.163.34
213.177.167.82
10.100.6.22
G729
G729
57300
49456
21623272448
249912279033
249912279033
249912010584
249912010584
rttrunk-sudan
rtlist-sudan
96249912010584
10.100.3.50
41.223.203.244
*2b06f487-342a99f3-53530cd2-25e@10.100.3.50
10.100.5.46
UNKNOWN
UNKNOWN
49262
249912279033
7088986757
7088986757
96264888716
96264888716
rttrnk-gwmsc2
rtlist-gwmsc2
216.53.4.5
10.100.3.50
Esbcsipuac.2_66.33.165.74_b09sb07_1_2009110209292117_1900037343_356308
66.33.165.73
10.100.6.50
G729
20038
49330
216.53.4.5
7088986757
 MGC-CDR-PGW1A
9.5(2)



dear steadyonabix ;
how did you convert the file to txt.
BR
# 12  
Old 11-04-2009
Good Morning SmilieThe only free utility I know of for unzipping rar archives is WinRAR: -http://download.cnet.com/WinRAR-32-bit/3000-2250_4-10007677.htmlOnce unzipped the resulting BIN file was passed to strings to give the above output. It should be a simple matter from there to convert it to CSV format.Good luck
# 13  
Old 11-04-2009
I also unrarred it on windows, transferred it to unix and used strings to feed the text content into my awk script above.
# 14  
Old 11-04-2009
thanks guys SmilieSmilieSmilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #653
Difficulty: Easy
Rocky Raccoon is the mascot of MINIX 3.
True or False?

10 More Discussions You Might Find Interesting

1. Programming

DB2 convert digits to binary format

Dear Team We use DB2 v10.5 and using DBArtisan tool Can someone please guide how to convert digits to binary numbers using db2 feature. Ex> for number 9 , binary should be 1001 ( 8+1) Any help appreciated. Thanks (2 Replies)
Discussion started by: Perlbaby
2 Replies

2. Shell Programming and Scripting

Convert csv data to html format

I am new to html and need to convert the attached csv file data to html format ; running into issues. please assist. #!/bin/ksh echo "<html>" ; echo "<head><style> table {border-collapse: collapse;} table, td, th {border: 1px solid black;} </style></head>" echo "<title> REPORT </title>" echo... (0 Replies)
Discussion started by: archana25
0 Replies

3. Shell Programming and Scripting

Convert jpg file to binary format

Hi Team, Here's the requirement. I have a image file in jpg format in unix. Now I need to i. convert the jpg format to binary format ii. followed by loading the binary file to Oracle db. Can anyone help me out? Thanks Krishnakanth Manivannan (4 Replies)
Discussion started by: kmanivan82
4 Replies

4. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

5. Programming

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:- USB History Dump by nabiy (c)2008 (1) --- Kingston DataTraveler 130 USB... (2 Replies)
Discussion started by: certteam
2 Replies

6. 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

7. Shell Programming and Scripting

Convert XML to CSV format

Can any one give the idea on this, please. I have the following XML file and wants to convert into CSV(comma separated value) format. <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE Waveset PUBLIC 'waveset.dtd' 'waveset.dtd'> <Waveset> <Object name='ra8736'> <Attribute name='ADDRESS'... (2 Replies)
Discussion started by: kumar04
2 Replies

8. Shell Programming and Scripting

Help needed to convert delimited to CSV format

I have a file with the data as follows.. FILE 1|#START|Jan 22 15:03 FILE 1|#END|Jan 22 16:06 FILE 2|#START|Jan 22 5:15 FILE 2|#END|Jan 22 5:25 FILE 3|#START|Jan 22 07:03 FILE 3|#END|Jan 22 08:15 FILE 4|#START|Jan 22 16:09 FILE 4|#END|Jan 22 16:55 FILE 1|#START|Jan 22 18:15 FILE... (5 Replies)
Discussion started by: karthikd214
5 Replies

9. 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

10. 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

Featured Tech Videos