Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I have a script below and within this script the following two lines - first line below need to stay the same, and the second line below needs the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    14

    script problem


    Hi,
    I have a script below and within this script the following two lines - first line below need to stay the same, and the second line below needs the .tar remove. Is there a sed command I can use to remove the .tar from the second line only ?


    tar xvf R1_P1000_ABCD_CAL_20101231_Config1C.tar

    ./Initialize.ksh R1_P1000_ABCD_CAL_20101231_Config1C.tar 20101231

    The "R1_P1000_ABCD_CAL_20101231_Config1C.tar" is a variable that I pass into this script below from another script.

    thank you


    #!/bin/sh
    #set -x
    ################################################## ##############################
    #
    # Copyright ABC plc 2011
    #
    # Name: Verify_Install.sh
    #
    # Version: V0.1
    # Date: 12-10-11
    #
    # Purpose: Verify Install Process
    #
    ################################################## ##############################

    #############################################
    # Start Verify Intall Processes #
    #############################################

    Verify_Install()
    {
    SCRIPTS_DIR=$HOME/Control_Management/scripts
    BUILD_DIR=$RELEASE/$CURRENT_CONFIG/Config
    PROCESS_DIR=$RELEASE/Scripts/Batch
    PACKAGE_CONFIG1C_DIR=$OPS/Project/Release1/Config1C/Dynamic

    cd $PACKAGE_CONFIG1C_DIR

    tar xvf R1_P1000_ABCD_CAL_20101231_Config1C.tar

    cd $PROCESS_DIR
    echo "Jobstream Verify_Install Started"
    echo " "

    ./Initialize.ksh R1_P1000_ABCD_CAL_20101231_Config1C.tar 20101231

    echo " "
    echo "Jobstream Verify_Install completed"
    }

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Does this do what you want?
    Code:
    cat script.sh|sed -e 's/^\(\.\/Initialize.ksh.*\)\.tar\(.*\)$/\1\2/'

  3. #3
    Just Joined!
    Join Date
    Oct 2011
    Posts
    14
    thank you - that has worked perfectly

  4. $spacer_open
    $spacer_close

Posting Permissions

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