File Parsing question: URGENT - Unix

This is a discussion on File Parsing question: URGENT - Unix ; Hello everyone, i need the syntax for the following example..here is my mapping file. Code: > cat newmaptest this is source this is destination /s01/oradata/jbld:/u01/oradata/test /s02/oradata/jbld:/u02/oradata/test how can i get the following command cp -rp /s01/oradata/jbld /u01/oradata/test cp -rp /s02/oradata/jbld ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: File Parsing question: URGENT

  1. File Parsing question: URGENT

    Hello everyone, i need the syntax for the following example..here is my
    mapping file.
    Code:
    
    > cat newmaptest
    this is source      this is destination
    /s01/oradata/jbld:/u01/oradata/test
    /s02/oradata/jbld:/u02/oradata/test
    how can i get the following command
    cp -rp /s01/oradata/jbld /u01/oradata/test
    cp -rp /s02/oradata/jbld /u02/oradata/test


    thanks a lot


  2. Re: File Parsing question: URGENT

    cat newmaptest|awk -F: '{printf "cp -rp %s %s\n", $1, $2}'


  3. Re: File Parsing question: URGENT

    Shekar wrote:
    > cat newmaptest|awk -F: '{printf "cp -rp %s %s\n", $1, $2}'
    >


    UUOC:

    awk -F: '{printf "cp -rp %s %s\n", $1, $2}' newmaptest

    Regards,

    Ed.

  4. Re: File Parsing question: URGENT

    Jigar2Reshma@gmail.com wrote:

    > Hello everyone, i need the syntax for the following example..here is my
    > mapping file.
    >
    Code:
    >
    >>cat newmaptest
    >
    >   this is source      this is destination
    > /s01/oradata/jbld:/u01/oradata/test
    > /s02/oradata/jbld:/u02/oradata/test
    >
    >
    > how can i get the following command
    > cp -rp /s01/oradata/jbld /u01/oradata/test
    > cp -rp /s02/oradata/jbld /u02/oradata/test
    >
    >
    > thanks a lot
    >


    awk -F: 'NR==1{next}{printf "cp -rp %s %s\n", $1, $2}' newmaptest

    Regards,

    Ed.

  5. Re: File Parsing question: URGENT

    On 2005-11-29, Jigar2Reshma@gmail.com wrote:
    > Hello everyone, i need the syntax for the following example..here is my
    > mapping file.
    >
    Code:
    
    >> cat newmaptest
    >   this is source      this is destination
    > /s01/oradata/jbld:/u01/oradata/test
    > /s02/oradata/jbld:/u02/oradata/test
    >
    >
    > how can i get the following command
    > cp -rp /s01/oradata/jbld /u01/oradata/test
    > cp -rp /s02/oradata/jbld /u02/oradata/test
    >
    >
    > thanks a lot
    >


    In tcsh:

    foreach i (`cat newmaptest`)
    set src=`echo $i | cut -f1 -d":"`
    set dst=`echo $i | cut -f2 -d":"`
    cp -rp $src $dst
    end

    --
    -=[cwa]=-
    e-Mail: chris at cwaiken dot net
    Home: www.cwaiken.net




  6. Re: File Parsing question: URGENT

    Jigar2Reshma@gmail.com wrote:
    > Hello everyone, i need the syntax for the following example..here is my
    > mapping file.
    >
    Code:
    >
    >>cat newmaptest
    >
    >   this is source      this is destination
    > /s01/oradata/jbld:/u01/oradata/test
    > /s02/oradata/jbld:/u02/oradata/test
    >
    >
    > how can i get the following command
    > cp -rp /s01/oradata/jbld /u01/oradata/test
    > cp -rp /s02/oradata/jbld /u02/oradata/test
    >
    >
    > thanks a lot
    >


    sed 's/^/cp -rp /;s/:/ /' newmaptest | sh

    --
    Chuck Dillon
    Senior Software Engineer
    NimbleGen Systems Inc.

+ Reply to Thread