How to make delimited record ????


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to make delimited record ????
# 1  
Old 01-31-2012
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:
Member Nbr~Member Name~Date~Date~Number~Miles~Rejected Reason~ Purge
1000000000~BROWNS N/B~10121998~01121998~377393930~500~INVALID CUSTOMER NUM~~


---------- 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
# 2  
Old 01-31-2012
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?
# 3  
Old 01-31-2012
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
# 4  
Old 01-31-2012
Well that is going to be difficult Smilie... 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.
# 5  
Old 01-31-2012
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~
# 6  
Old 01-31-2012
Quote:
Originally Posted by ns64110
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.
# 7  
Old 01-31-2012
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help/Advise please for converting space delimited string variable to comma delimited with quote

Hi, I am wanting to create a script that will construct a SQL statement based on a a space delimited string that it read from a config file. Example of the SQL will be For example, it will read a string like "AAA BBB CCC" and assign to a variable named IN_STRING. I then concatenate... (2 Replies)
Discussion started by: newbie_01
2 Replies

2. Shell Programming and Scripting

How to delete 'duplicated' column values and make a delimited file too?

Hi, I have the following output from an Oracle SQL statement and I want to remove duplicated column values. I know it is possible using Oracle analytical/statistical functions but unfortunately I don't know how to use any of those. So now, I've gone to PLAN B using awk/sed maybe or any... (5 Replies)
Discussion started by: newbie_01
5 Replies

3. Shell Programming and Scripting

Insert a header record (tab delimited) in multiple files

Hi Forum. I'm struggling to find a solution for the following issue. I have multiple files a1.txt, a2.txt, a3.txt, etc. and I would like to insert a tab-delimited header record at the beginning of each of the files. This is my code so far but it's not working as expected. for i in... (2 Replies)
Discussion started by: pchang
2 Replies

4. Shell Programming and Scripting

How to make tab delimited file to space delimited?

Hi How to make tab delimited file to space delimited? in put file: ABC kgy jkh ghj ash kjl o/p file: ABC kgy jkh ghj ash kjl Use code tags, thanks. (1 Reply)
Discussion started by: jagdishrout
1 Replies

5. Shell Programming and Scripting

Need a script to convert comma delimited files to semi colon delimited

Hi All, I need a unix script to convert .csv files to .skv files (changing a comma delimited file to a semi colon delimited file). I am a unix newbie and so don't know where to start. The script will be scheduled using cron and needs to convert each .csv file in a particular folder to a .skv... (4 Replies)
Discussion started by: CarpKing
4 Replies

6. Shell Programming and Scripting

Managing sequence to make unique record

Hi Everyone, Using shell script i am getting final file as attached below. In this 4th column value should be unique using any sequence. for instance I've 1_13020_SSGM which is appearing 6 times in file and i should change it like 1_13020_SSGM_1,1_13020_SSGM_2,....1_13020_SSGM_6. Can someone... (4 Replies)
Discussion started by: gehlnar
4 Replies

7. Shell Programming and Scripting

Make variable length record a fixed length

Very, very new to unix scripting and have a unique situation. I have a file of records that contain 3 records types: (H)eader Records (D)etail Records (T)railer Records The Detail records are 82 bytes in length which is perfect. The Header and Trailer records sometimes are 82 bytes in... (3 Replies)
Discussion started by: jclanc8
3 Replies

8. Red Hat

Counting columns in a delimited record with NULLs

I am trying to count the number of columns in a delimited flat file. The record is tab delimited. When I use the command wc -w, I am getting unexpected results when the record contains a NULL value. I believe it is because there is a "word" missing. The below example will return 4 words... (2 Replies)
Discussion started by: nmalencia
2 Replies

9. Shell Programming and Scripting

Split a record ( in a row) and make it as new row

Hi All, The following is the scenario id name -------------- 1 William;Johnson 2 Azim;Abdul 3 Grasim . . etc.... I need the following output id name -------------- 1 William 1 Johnson 2 Azim (2 Replies)
Discussion started by: kottursamy
2 Replies

10. Shell Programming and Scripting

help with awk delimited by |~| in a record

I have a file which contains 1 million records of the following format. Each field is delimited by a pipe tilda pipe "|~|" show below. I would like to print only one column ie the CARDDESC value. for example here it says CARDDESC=A8T1. so anything after CARDDESC= and before |~|CARDTYPE is what... (11 Replies)
Discussion started by: knijjar
11 Replies
Login or Register to Ask a Question