#something here
port 4444
#something here
port 4444
So I have file like above , I would to find the line with word "port" and increment the number(the number can be any number - not necessary it's fixed at 4444) next to it by 1.
For example,result file should be of the form
#something here
port 4444
#something here
port 4445
Any thoughts, I think we need use sed , but not sure about incrementing it.
EDIT: Sorry again,I thought I get answer based in sed , so didn't think about positions. Here is the exact file contents
$cat file
data dev-1
type client
option type tcp
option host 99.160.131.163
option nodelay on
option port 6996
end
data dev-2
type client
option type tcp
option host 99.160.131.164
option nodelay on
option port 6996
end
I would like to change the port number and increment it.Sorry again for inconvenience.