![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple input field Separators in awk. | kinksville | Shell Programming and Scripting | 4 | 04-25-2008 06:12 PM |
| Creation of script,if the data file have more than one entry!!! | bobprabhu | Shell Programming and Scripting | 1 | 02-07-2008 09:26 AM |
| How to get a data creation file | superfabius | UNIX for Dummies Questions & Answers | 2 | 05-18-2007 11:33 AM |
| Get data creation file | superfabius | UNIX for Advanced & Expert Users | 1 | 05-18-2007 10:05 AM |
| input of data | ljdav2 | Shell Programming and Scripting | 3 | 09-05-2004 11:01 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Help with Creation of Script to Input Separators in Data
Hi all,
I have one problem that is preparing datas so I can run a script to extrat informations for my statistic reports. I receive some datas, that are informations mixed and I need to separate them to analyse. This is an exemple of datas: #header: 0MEPS000006000000051620090508001200905070010001613200020090508001 #body: 20421730007384620090507144018000001000000000A000000020283139Somewhere 00000001600 #body: 20421730007414520090507144237000001000000000A000000020283148Somewhere 00000001700 #body: . #body: . #body: . #body: . #body: . #body: . #tail: 9000000020000000000020000000000000000000000000000 Note that this #body, header does not include in this data. So I receive them like this, but I need them to be like this: 0,MEPS,00000600,00000516,20090526001,20090525001,00016,132,000,20090526001, 2,04,2191,00112407,20090525233138,0000200000,00000,A,0000000502,98032,Somewhere ,020000008,0,0, 2,04,2191,00008894,20090525075812,0000010000,00000,A,0000001301,55245,Somewhere ,100000147,0,0, . . . . 9,00000059,0000000001790000,000000000000,000000000000, So in this manner I can run my script: #!/bin/bash echo " serial_nb amount date time ATM_nb location" awk -F, '$1==2 {print$13,$7,$5,$6,$10,$12}' file_name which produce me the results I want: serial_nb amount date time ATM_nb location 000000016 0000010000 20090507 144018 0000000202 Somewhere 000000017 0000010000 20090507 144237 0000000202 Somewhere So, right now I prepare my datas with the aid of excell, but I rather use an awk command to to this. I need a command that says: input "," after 2 characters, then input another one after 5, etc etc. Bottom line, a command that inputs separators acording to lenght. Thanks for all your help. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|