Find the answer to your Linux question:
Results 1 to 2 of 2
How to change the following line a large file, ----- 25 acc This parameter controls the accuracy. ----- to the line ----- 500 acc This parameter controls the accuracy. ----- ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    4

    Question shell command: search and change a line

    How to change the following line a large file,
    -----
    25 acc This parameter controls the accuracy.
    -----
    to the line
    -----
    500 acc This parameter controls the accuracy.
    -----

    sed/awk/grep?

    I cannot really search for 25 and replace it with 500 as there are many instances where 25 occurs within the file. Apart from the number the line is very unique. So I can grep the line, but I do not know how to change that specific entry in that file.

  2. #2
    Just Joined!
    Join Date
    Oct 2004
    Posts
    62
    cat ...file... |sed 's/25 acc This parameter controls the accuracy./500 acc This parameter controls the accuracy.' > xxx
    cp xxx ...file....

Posting Permissions

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