0

A file mytext.txt has in line number 20

<mytext=SO svn=myrepo number=2.1.0>   

using SED or AWK I would like to change the line number 20 of mytext.txt to

<mytext=SO svn=myrepo number=2.1.6>
user1651888
  • 463
  • 2
  • 9
  • 25
  • possible duplicate of [bash: replace an entire line in a text file](http://stackoverflow.com/questions/11145270/bash-replace-an-entire-line-in-a-text-file) – fedorqui May 15 '14 at 14:37
  • Is it always line # 20 that you want to change OR certain pattern needs to be matched before replacement? – anubhava May 15 '14 at 14:56

2 Answers2

0
awk 'NR==20{$0="NEW TEXT"}7' file

next time do some man sed/awk before post.

Kent
  • 189,393
  • 32
  • 233
  • 301
0

with sed:

sed -ri '20 s/2.1.0/2.1.6/g' file
Tiago Lopo
  • 7,619
  • 1
  • 30
  • 51