replacing a line with spaces
I have a line like
port = 2566 I want to replace it as port = 8080 does anyone knows how to do this in shell script. when i tried to do this with sed sed -i 's/port=.*/port='$3'/' /root/$2 it is not recognizing spaces , it works only if line is port=2566 . any idea on how to do this? |
Quote:
Code:
sed -i 's/port = .*/port = '$3'/' file |
thanks... I tried giving space but it dosent work.. :-(
|
Maybe it is a tab or a mix, try using character list instead:
Code:
sed -i "s/port[[:space:]]*=[[:space:]]*.*/port = $3/" file |
You can use this
sed -i 's/2566/8080/' FilePath |
@munavar - only if we assume that it exists nowhere else in the file
|
Quote:
|
All times are GMT -5. The time now is 06:04 AM. |