Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Posts
    11

    Unanswered: 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

  2. #2
    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.

  3. #3
    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

  4. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •