help needed for simple unix command
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: help needed for simple unix command

  1. #1
    Join Date
    Feb 2003
    Location
    New York
    Posts
    75

    help needed for simple unix command

    Hi, all
    I have a file to load into oracle database, in my source file, there are " " on the numbers, for instance, "12345", I need to get rid of the " ", but don't know the command, could someone help me, Thanks.
    The file is too big, have to do on unix platform.
    DF
    Still learning

  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    man sed
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Feb 2001
    Posts
    295
    Didn't see your point. You want just to truncate all the spaces in the file? Try this:

    sed 's/ //g' source_file > dest_file
    mv dest_file source_file
    An ounce of action is worth a ton of theory.
    —Friedrich Engels

  4. #4
    Join Date
    Feb 2003
    Location
    New York
    Posts
    75
    what I want is change "12345" to 12345. Thanks.

    DF
    Still learning

  5. #5
    Join Date
    Feb 2001
    Posts
    295
    Well, you can remove all the symbols with:

    sed 's/\"//g' source_file > dest_file

    Otherwise, you'll have to run several commands like:

    sed 's/\"1/1/' source_file > dest_file_1
    sed 's/1\"/1/' dest_file_1 > dest_file_2
    sed 's/\"2/2/' dest_file_2 > dest_file_3
    .
    .
    and so on. Do as Jeff said, "man sed" and run it as a loop in a shell script.
    An ounce of action is worth a ton of theory.
    —Friedrich Engels

  6. #6
    Join Date
    Feb 2003
    Location
    New York
    Posts
    75
    Thanks very much for all your help.
    Still learning

  7. #7
    Join Date
    Jul 2001
    Location
    Slovenia
    Posts
    422
    If you will load it with sqlldr, you don't have to pre-parse the file, just use optionally enclosed by '"'
    Tomaž
    "A common mistake that people make when trying to design something completely
    foolproof is to underestimate the ingenuity of complete fools" - Douglas Adams

Posting Permissions

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



Click Here to Expand Forum to Full Width