SUMMARY: sed help

From: Bhavesh Shah (bshah_at_citadon.com)
Date: 10/12/05

  • Next message: Christopher L. Barnard: "changing chown command"
    Date: Wed, 12 Oct 2005 12:56:06 -0700
    To: <sunmanagers@sunmanagers.org>
    
    

    Well I got response from other forum just after I posted here.
    Sorry for the trouble.

    The correct way is:

    Sed '/insert/r source_file' final_file > result_file

    Best Regards
    B

    -----Original Message-----
    From: Bhavesh Shah
    Sent: Wednesday, October 12, 2005 12:40 PM
    To: sunmanagers@sunmanagers.org
    Subject: sed help

    Hi Gurus,

    Sorry for the off topic. I am trying to get the script working but am
    stuck. I tried googling and other unix forum but unable to get this
    working so finally I turned to you gurus. I am struggling to get this
    working since yesterday. If you can help me will be great help for me.

    #! /bin/ksh

    SOURCE=`cat source_file`

    echo $SOURCE

    sed '{

    /insert/a\

    '$SOURCE'

    }' final_file > result_file

    cat source_file

    test1

    test2

    test3

    cat final_file

    insert

    If source_file has only one line it works but multiple line fails with
    sed error. The problem is my source_file is a variable and i can't put
    it directly inside sed command.

    Any help is greatly appreciated.

    Sorry for the trouble.

    Regards

    B
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Christopher L. Barnard: "changing chown command"

    Relevant Pages

    • unsubscribe
      ... > Sorry for the trouble. ... > Best Regards ... > working so finally I turned to you gurus. ... > cat source_file ...
      (SunManagers)
    • Re: The Shit Hits The Fan On CNC Advertising Zone
      ... Posted Today On CNC Advertising Zone By HemiCuda: ... regards to my previous post. ... This is a Help Forum with the intention of sharing information ... moderate the posts and make sure no violations are occurring ...
      (alt.machines.cnc)
    • Re: Rich Burlew
      ... stir up trouble, since that might be fun to see... ... worry in advance. ... How much can a forum be worth if you have ... "So there is no third law of Terrydynamics." ...
      (rec.games.frp.dnd)
    • Re: Tough Problem: Anonymous Posting Enabled Forum
      ... >> I am developing an ASP.net forum in our intranet. ... >> require the IT professionals to check up the IIS W3C ... >> Best Regards, ... >> W. Jordan ...
      (microsoft.public.dotnet.framework.aspnet)
    • Re: remove one set from another set
      ... Sometime I was wondering if there was a rule on this forum. ... are hard for us but simple for gurus. ... learners and I am not intending to become a good programmer,just ... > [ENTER pedagogical mode] ...
      (comp.soft-sys.matlab)