![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sorting an ascii file | shes | UNIX for Dummies Questions & Answers | 2 | 10-08-2008 06:11 AM |
| How to convert English text file to ASCII File? | laknar | Shell Programming and Scripting | 1 | 07-23-2008 09:37 AM |
| Strange difference in file size when copying LARGE file.. | 0ktalmagik | Filesystems, Disks and Memory | 1 | 06-03-2006 07:34 PM |
| ASCII file | sherbet808 | UNIX Desktop for Dummies Questions & Answers | 1 | 06-13-2003 09:46 PM |
| How can I ... (Modifying large ASCII files) | hviktor | UNIX for Dummies Questions & Answers | 2 | 07-20-2001 10:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Formatting large Ascii file
Hi, I've got a very large ASCII file (1.5 GB), which doesn't have line terminators, making it impossible to read it right, i need to format it like:
add line terminators. delete some lines on the file. delete some fields on all the remainings lines (can be identified by a string). After getting the file under the correct format i will inject it into a mysql DB, file details: ASCII text, with very long lines, with no line terminators, i already tried tr and sed , but i cannot get it right. hexdump head: 0000000 3136 3937 3934 3134 2032 2020 2020 4120 0000010 5249 2020 4d54 2053 4120 5249 2020 3137 0000020 3131 3131 2030 2020 2020 2020 2020 2020 0000030 2020 2020 2020 2020 2020 2020 2020 2020 * 0000070 2020 2020 2020 2020 2020 2020 3032 3730 0000080 3231 3732 3031 3131 3934 3032 3730 3231 0000090 3732 3330 3030 3030 3130 3038 3130 2020 00000a0 3236 3137 3630 3638 2030 2020 2020 4120 00000b0 5249 2020 4d54 2053 4120 5249 2020 3137 00000c0 3131 3131 2030 2020 2020 2020 2020 2020 00000d0 2020 2020 2020 2020 2020 2020 2020 2020 * 0000110 2020 2020 2020 2020 2020 2020 3032 3730 0000120 3231 3732 3031 3131 3934 3032 3730 3231 0000130 3732 3231 3030 3030 3130 3038 3130 2020 0000140 3236 3537 3332 3737 2036 2020 2020 4120 0000150 5249 2020 4d54 2053 4120 5249 2020 3137 0000160 3131 3131 2030 2020 2020 2020 2020 2020 0000170 2020 2020 2020 2020 2020 2020 2020 2020 * -- Best regards. |
|
||||
|
examples.
Thanks for your reply, Example input, keep in mind it doesn't have line terminators , so when you open it on big terminals it get imposible to read:
617955555 AIR TMS AIR 7111110 2007122710114920071227030000018001 627166666 AI R TMS AIR 7111110 2007122710114920071227120000018001 627577777 AIR TMS AIR 7111 110 2007122710114920071227120000018001 627588888 AIR AME AIR 7311110 2007122710114920071227030000018001 627599999 AIR AME AIR 7311110 example output: 617955555 AIR TMS AIR 627166666 AIR TMS AIR 627577777 AIR TMS AIR 627588888 AIR AME AIR 627599999 AIR AME AIR Best regards. |
|
||||
|
dd is your friend.
Start with this: Code:
dd ifile=inputfilename ofile=outputfilename cbs=22 conv=unblock |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|