D
D
Dima Kim2016-01-26 19:43:56
linux
Dima Kim, 2016-01-26 19:43:56

How to add an entry to a file?

Good afternoon, tell me how to add an entry to a file from the terminal?
For example, such a condition
Add
192.168.1.1 after the line IPADDR=
255.255.255.0 after NETMASK=
What would the condition look for, if there is, it should add a value, if not, then + parameters and value.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey P, 2016-01-26
@ruddy22

1. > vim ./file
2. > /IPADDR (поиск) (нажать / и ввести строку, нажать enter)
3. > f= 
4. > a (insert mode) (нажать а)
5. > 192.168.1.1
6. > esc (нажать ESC)
7. > /NETMASK
8. > шаг 3 и 4
9. > 255.255.255.0
10. > esc
11. > :wq (сохранить и закрыть) (нажать : и ввести 2 буквы)

A
Alexander Slyzhuk, 2016-01-27
@SLYzhuk

apt-get install mc

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question