Find the answer to your Linux question:
Results 1 to 5 of 5
Hi every Body, I have a file like this This software has been provided pursuant to a License Agreement * containing restrictions on its use. This software contains * valuable ...
  1. #1
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    107

    how to replace Word with new word

    Hi every Body,

    I have a file like this


    This software has been provided pursuant to a License Agreement
    * containing restrictions on its use. This software contains
    * valuable trade secrets and proprietary information of
    * Macrovision Corporation and is protected by law. It may
    * not be copied or distributed in any form or medium, disclosed
    * to third parties, reverse engineered or used in any manner not
    * provided for in said License Agreement except with the prior
    * written authorization from Macrovision Corporation.
    ************************************************** ****************************
    *
    * Description: Used to generate lm_new.o/.obj and by license-
    * generators.
    *
    * Once the kit is "built" (using make or nmake) this file is no longer
    * needed, but should be stored somewhere safe.
    *
    * Set the following values:
    * VENDOR_KEY1-5 Provided by Macrovision Corporation.
    * VENDOR_NAME If not evaluating, set to vendor name.
    * LM_SEED1-3 Make up 3 32-bit numbers, (or use
    * 'lmrand1 -seed' to make up), keep secret, safe,
    * and never change.
    * TRL_KEY1-2 Provided by Macrovision if TRL used.
    * LM_STRENGTH: If using TRL, set to desired length
    *
    * Upgrading: from version older than 8.1: Copy your
    * ENCRYPTION_SEEDs from the old lm_code.h file.
    * Make sure LM_STRENGTH matches, if you were
    * using LM_STRENGTH
    */

    #ifndef LM_CODE_H
    #define LM_CODE_H


    #include "cvd_lm_code.h"
    #include "lm_trl.h"
    /*
    * Vendor keys: Enter keys received from Macrovision.
    * Changing keys has NO impact on license files
    * (unlike LM_SEEDs).
    */
    #define VENDOR_KEY1 0x0
    #define VENDOR_KEY2 0x0
    #define VENDOR_KEY3 0x0
    #define VENDOR_KEY4 0x0
    #define VENDOR_KEY5 0x0
    /*
    * Vendor name. Leave "demo" if evaluating. Otherwise,
    * set to your vendor daemon name.
    */
    #define VENDOR_NAME "qavend1"
    /*
    * Private SEEDs: Make up 3, 8-hex-char numbers, replace and




    I want to replace the VENDOR_KEY1 value only with new value , how do i change the VENDOR_KEY1 , (NOTE :it will not impact the other VENDOR KEYS)


    Pls Can anybody help me out

    THanks in Advance

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    According to the comment in the header of the file, you are not allowed to redistribute that code unless you got permission from the owner. And that's what you are just doing here.

    Quote Originally Posted by mallik View Post
    I want to replace the VENDOR_KEY1 value only with new value , how do i change the VENDOR_KEY1 , (NOTE :it will not impact the other VENDOR KEYS)
    I don't know what do you expect. If you want to change the value, then change it. It's the number in hex format after "VENDOR_KEY1" on the #include line. We don't own that source code, so we can't even start to think what values would have any meaning at all, though.

    The question is way too vague and imprecise.

  3. #3
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    107

    Replacing the word in a file

    Hi ,

    Actually , the format is like this in a file

    #define VENDOR_KEY1 0x0
    here some data is there
    #define VENDOR_KEY2 0x0
    here also some data are
    #define VENDOR_KEY3 0x0
    #define VENDOR_KEY4 0x0
    #define VENDOR_KEY5 0x0

    So , i want to replace the "0x0" value of "VENDOR_KEY1" to some 0x123456.

    My problem is , if i use "sed" , matching pattern as a "0x0" , it is replacing all "VENDOR_KEYS" . But i need to change only the first line.


    Pls help me out....

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by mallik View Post
    Hi ,

    Actually , the format is like this in a file

    #define VENDOR_KEY1 0x0
    here some data is there
    #define VENDOR_KEY2 0x0
    here also some data are
    #define VENDOR_KEY3 0x0
    #define VENDOR_KEY4 0x0
    #define VENDOR_KEY5 0x0

    So , i want to replace the "0x0" value of "VENDOR_KEY1" to some 0x123456.

    My problem is , if i use "sed" , matching pattern as a "0x0" , it is replacing all "VENDOR_KEYS" . But i need to change only the first line.


    Pls help me out....
    Now it's clearer what you intend to do.

    If you have this into a file called a.txt

    #define VENDOR_KEY1 0x0
    here some data is there
    #define VENDOR_KEY2 0x0
    here also some data are
    #define VENDOR_KEY3 0x0
    #define VENDOR_KEY4 0x0
    #define VENDOR_KEY5 0x0
    This command will do that:

    Code:
    sed -e 's/VENDOR_KEY1 0x0/VENDOR_KEY1 0xffffffff/' a.txt
    You can then use redirection to save the new output as another file or whatever.

  5. #5
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Or even:
    Code:
    sed '/VENDOR_KEY1 /s/0x0/0xffffffff/' a.txt

Posting Permissions

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