How to make delimited record ????

Can anyone suggest how to make delimited data for below report format

Member Nbr Member Name Date Date Number Miles Rejected Reason Purge

1000000000 BROWNS N/B 10121998 01121998 377393930 500 INVALID CUSTOMER NUM

issue is that my column name, data and between column i have variable spaces.
But i had fixed column name whenever i got the report

Output:

[LEFT]Member Nbr~Member Name~Date~Date~Number~Miles~Rejected Reason~ Purge
1000000000~BROWNS N/B~10121998~01121998~377393930~500~INVALID CUSTOMER NUM~~[/LEFT]

---------- Post updated at 02:34 AM ---------- Previous update was at 01:36 AM ----------

Hi Anyone can help me on above requirment as it is urgent

Issue is that the fields (or cell data) may contain many white spaces. So if that is the case, even if the column lengths are fixed length, then also, deriving data will not be that easy.

Are you saying that even the data inside different cells/columns will have fixed-lenght data?

main issu eis that even data part is not having fixed length, because report that i recv is human readable format how can i make it machine readable form that is my challenge.

is it possible if can count number of character between each column and on the basis of that i can retirve data

Well that is going to be difficult :(... What is the source of your data? Is it again generated by another script?

Difficult with such data file is that the content are free flowing. For such, there will always be a chance of data inconsistencies in the output even if we manage to write some script to parse this data file.

If you have the script which gives you this data file as input, then I will suggest making amends in that script itself... atleast make some provision that the data you receive are properly enclosed in single/double quotes.

actually i am getting this file from third party and i need to process it

is it possible if we can count number of character between each column suppose

so that we can get length of each column and retrivee data on length basis

---------- Post updated at 04:14 AM ---------- Previous update was at 04:06 AM ----------

One more question can we retrieve last three column

I/P:

1999999488~TESTING/D~12042009~12042009~0904060004~2500~ACCEPTED~
1999999497~TESTING/E~12042009~12042009~0904060006~1000~ACCEPTED~P
1999999513~PBBBBBBB~SNAME/P~12042009~12042009~0904080001~5000~ACCEPTED~

i want to fetch last 4 column

o/p:

0904060004~2500~ACCEPTED~
0904060006~1000~ACCEPTED~P
0904080001~5000~ACCEPTED~

yes you can retrieve the last 4 columns from delimitted file.

We can indeed count the length of column and then retrieve data. But on basis of which you will take the length of the column? Will the Header will form the base for the length of the data under them? If that is the case, then things can be easier for u... But u urself said that the data under each header/column will not have fixed length. So again, things will be difficult.

Yes Header will form the base for the length of the data under them,

because size between to column depends on data part tats y i said we have fixed column name but data length is variable.

if we header is base how can we resolve this one

Print last four columns using below command

awk -F"~" '{for(i=NF-3;i<=NF;i++){printf $i"~"}printf "\n"}' Filename