DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Urgent

  1. #1
    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    323
    Hi

    Any one can suggest me web site on UNIX shell commands. Can any one give some shell commands which are useful in daily DBA'S life.

    How can I put some character at the end of the line or beginning of the line using shell command in vi editor.

    Thanks in advance

    Nagesh

  2. #2
    Join Date
    Jul 2000
    Location
    Oxford, OH
    Posts
    117
    I would go to altavista and type something like "Unix Shell Commands"

    How is this urgent????

    Joe
    _________________________
    Joe Ramsey
    Senior Database Administrator
    dbaDirect, Inc.
    (877)687-3227

  3. #3
    Join Date
    Jul 2000
    Posts
    119
    yes joe , i agree with you ...

  4. #4
    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    323
    Hi joe,

    It is urgent, because i need to modify one big file which contains near about 50,000 records. For which i need to put quotations marks and commas and then i need to use those records in one sequel statement which is very urgent for me. That is why i mentioned it is urgent.

    I hope I cleared you in this regard.
    Nagesh

  5. #5
    Join Date
    Jul 2000
    Location
    Oxford, OH
    Posts
    117
    Gnagesh,

    I'm not a moderator so it's no big deal :) Just as a suggestion, you might want to post the real issue when you say something is Urgent in the subject line. I imagine many of us try to look at a posting quickly if someone marks it urgent. If people mark postings as urgent when they are not, it may lead people to start treating Urgent posts like any other which would be a shame. Also, you probably would have gotten a better answer to your real question. You probably don't need "Unix Commands" for this problem. You probably need to look at something like awk or sed.

    Are you saying that you have a text file that you need to insert some delimiters around to bring the file into the database? If it's not in a fixed-length format and the data isn't uniform then that's probably going to be an issue. If you
    can email me a sample of 40 or 50 rows I'd be glad to take a look and help you out if you haven't resolved the issue already. Send the file to Oracle_8_DBA@hotmail.com

    _________________________
    Joe Ramsey
    Senior Database Administrator
    dbaDirect, Inc.
    (877)687-3227

  6. #6
    Join Date
    Mar 2000
    Location
    india
    Posts
    54
    Hi,

    At the vi command promt

    Syntax :1,$s/searchstring/replacestring/g

    For your requirement,you can use like this
    :1,$s/$/"/g

    This command will work like this starting from 1st line to the end of the file(last line), 's' for substitutes, (next dollar sign $ means) end of each line substitute double quotes and g for globally.
    Hope this helps you.

  7. #7
    Join Date
    Aug 2000
    Location
    Singapore
    Posts
    323
    Hi all,


    Thanks for your co-operation and guidance in solving the problem. Finally I solved the problem by using the following
    command.

    I have done like this :

    To add any thing at the beginning of the line :-

    :%s/^/you want?

    For example : I have a text like 1.23455. After applying the above it will be '1.23455

    To add at end of the line :-

    :%s/$/you want?


    Now the above text will become '1.23455', the result I want.

    NOTE : ^ is Shift + 6

    Thanks for everything.



    Nagesh

  8. #8
    Join Date
    Oct 2000
    Posts
    76
    Are you going to use vi to modify your file? If so, check out the vi commands. You can do a replace easily for the entire file.
    J.T.

  9. #9
    Join Date
    Aug 2000
    Location
    Belgium
    Posts
    342
    Be carefull when using vi for very large files.

    It will fil the /var directory.

    You can also use the sed command to change something :

    cat MyFileToChange | sed "s/<from>/<into>/[g: optional]"

    you want to change every line that begins with SQLSERVER to ORACLE

    cat MyFile | sed "s/^SQLSERVER/ORACLE/"

    Hope this helps
    Gert

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