A
A
AirFlare2021-03-07 23:24:47
bash
AirFlare, 2021-03-07 23:24:47

How to replace certain strings?

There is this line:

# secureboot
service setlockstate /sbin/setlockstate
   class core
   oneshot
   seclabel u:r:vold:s0

This block in the code field must be replaced with # secureboot off. How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2021-03-07
@AirFlare

For starters, this is a comment, why change it?
Second, use, for example, sed
sed -i 's/чтоменять/на что менять/g' filename
PS To replace the entire block, you can specify a null delimiter and write a regexp that captures the entire block, for example

sed -zi 's/# secureboot\nservice.*\n.*class core\n.*oneshot\n.*seclabel.*/# secureboot off/g' FILENAME

A
Alexander, 2021-03-07
@shabelski89

sed 's/# secureboot/# secureboot off' < infile > outfile

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question