The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-14-2006
oott1 oott1 is offline
Registered User
  
 

Join Date: Feb 2004
Posts: 2
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:28 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0