Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Manipulation Problem

Status
Not open for further replies.

hello99hello

Programmer
Jul 29, 2004
50
0
0
CA
DP1 080 000
RWP20004 SM000016721788446C05102A 21875345804015240800+0085834058300217700+000000000+ 71
RWP20004 00000014768200+S2 0050102009583405833652+0145834380408000+S2 005258403840101
RWP2000400000+000000000+000000000+000000000+0000055834509440+000000000+000000000+00RWPX99



Hello All,

I have a file with the following sample record:

My aim is to extract some fields from the lines of current record to make a new record for each id number.

Here are some facts about current line formart.
-There are three lines, like above, for each employee.
-each line of above for each employee always begins with (2 spaces) RWP20004.

-each line of above for each emoployee always ends with rwpx99.

-Each line includes spaces and other character such as + and X.

My objective is go through the file, go throught the lines one at a time, and do the following:

-Make an Header like Employee ID, current, future etc

Extract value 20004 starting from position 6 to 11 ( co-ordinates giving ) after first RWP20004 and put it under Employee ID.

Extract values 4768200 and 8000 after the second RWP20004 ( start and end #s of fields giving after the second RWP20004).

These values are to be put under the apropriate headings as well.

Is there any suggestion as to how this could be achived, else I will have to result into creating a temporary table, write a control file,
and load into temp table and extract from temp table.

Thanx Everyone.

 
And what have you so far ?
man awk

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have only done latter part creating a temp table.

I was gonna use the script method too, just to provide a means to check my result from above.

Thanx,

Ans to gain the experience too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top