D
D
DVoropaev2018-11-17 22:59:14
linux
DVoropaev, 2018-11-17 22:59:14

How to edit config files in BASH?

I have the following task:
There are many files (these are control files that are used to build deb packages) in which you need to edit one line (add dependencies)
, here is an example file:

spoiler
Package: adfi
Version: 1.0
Section: utils
Priority: optional
Architecture: all
Depends: telnet, nmap, expect
Maintainer: Voropaev Dmitriy <[email protected]>
Description: ADFI - Utility to search the network for devices using standard login / password for telnet access.


You just need to add a few more words to the Depends field.
How will it be easier to do this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sanes, 2018-11-17
@Sanes

Ansible doesn't work? There and work with lines and templates is. And in general, everything is simpler and YAML looks prettier.

K
ky0, 2018-11-17
@ky0

You write a loop and inside it add the necessary information to all files in turn - grep, sed, awk, that's all. What is the difficulty?

S
sim3x, 2018-11-17
@sim3x

Easier to edit, maintain - python
If you want hardcore - sed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question