If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Shell Scripting(interesting)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-21-04, 17:51
vootkur vootkur is offline
Registered User
 
Join Date: Jun 2004
Posts: 11
Shell Scripting(interesting)

Hi,

Here is my problem.

I will be getting a file with fixed width format.
Here i need to develop an utility in such a way that if i give the file name,then the script should generate 2 files,one with the data seperated by commas and the other file file with the metadata information.
for ex:

assume that this is my input file:

state desc
----- ----
TX Texas
Mi Michigan


the output should be like this
datafile:
TX,Texas
Mi,Michigan

Metadata File:
Col1 2
Col2 20

This is how the output should look like.
And the script should not be specific to this file,whatever the file i should be able to generate 2 files (commma seperated,metadata).

please give me some suggestions,how this can be done,with this there might be spaces in the data so the utility should be able to take that into consuderation.its urgent

I am not that good in shellscripting,so please be elaborative with ur answers
so that i can understand.

Thanks
vootkur
Reply With Quote
  #2 (permalink)  
Old 06-21-04, 17:58
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
how do you derive the values in the metadata file?
where do the values '2' and '20' come from?

P.S. for the future - if any of the replies to you original posts do answer your question, it would be nice to know.
Reply With Quote
  #3 (permalink)  
Old 06-22-04, 14:36
vootkur vootkur is offline
Registered User
 
Join Date: Jun 2004
Posts: 11
working with files

Hi vgersh,

Thank u very much for ur help.
Could me help me in writing a scrpit that is generalised in a way that whatever the file i give as an input(fixedwidth format files) the outputfile should be comma delimited,and there should not be any header and footer,this should work for any number of columns.can u also suggest me what should be done if there is no data in a column.For now if there is no data the next column value is sitting next to the comma.

Thanku
vootkur
Reply With Quote
  #4 (permalink)  
Old 06-22-04, 14:43
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
pls don't post the same question to multiple threads.

If you no longer are interested in the original thread - pls say so.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On