![]() |
|
|
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 |
| urgent-extracting block data from flat file using shell script | shirish_cd | Shell Programming and Scripting | 4 | 02-06-2008 09:05 AM |
| lining up columns of data | pau | Shell Programming and Scripting | 2 | 05-16-2006 10:40 AM |
| How to compare two flat files and get changed data | jtshashidhar | Shell Programming and Scripting | 3 | 01-29-2006 10:26 PM |
| How to compare data in two flat files and update them? | rajus19 | Shell Programming and Scripting | 3 | 11-08-2005 11:13 AM |
| processing data in a flat file | wolkott | Shell Programming and Scripting | 4 | 01-27-2003 01:57 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Help with Data Positioning from Columns in a flat file.
Hi All,
I have used this forum many times to solve my many scripting problems. This time, I would like to seek some answers to a problem that I've been head scratching quite a bit on. My Example: I am converting a 2000-byte file into a 300-byte file this file has no delimiters and hardly any spaces inbetween the cols... I have successfully converted most of the 2000-byte cols into the 300-byte file format by using awk's substr function, but I am having an issue in getting 1 col of the 2000-byte file to space properly in the 300-byte file. SUBSTR would work perfectly if the data was positioned all the same way. My dilema, The 2000-byte column starts at position 150 and ends at 180 (30 bytes) this col contains city,state,zip code info and the positioning of these items varies per record... example record#1 anytown us 11111 example record#2 any town us 11111 example record#3 anytown us11111 etc, The requirements, I have to specifically place the city info into position 159-181 of the 300-byte file I have to specifically place the state info into pos 182-183 & I have to spcifically place the zip info into pos 184-188 Not sure what would work best, since I have to keep intact the integrity of each record as well.....and then manipulate this col .... without trashing anything else....I would appreciate any ideas... thanks... ![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|