我不是开发人员,也不是与IT密切相关的人,我是医学生,我只是想使用sed shell命令使用Tasker编辑xml文件(电报通知共享首选项)。 这是xml文件:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?><map>
<int name="diditem-1147514813" value="11890" />
<boolean name="EnableContactJoined" value="true" />
<int name="diditemo-1088528518" value="241" />
<int name="spam3_-1482963590" value="1" />
<int name="spam3_-1332601105" value="1" />
<string name="org.telegram.key-1363717298"></string>
<int name="spam3_98617228" value="1" />
<int name="spam3_-1140252249" value="1" />
<int name="notify2_-1408220341" value="2" />
<boolean name="silent_-1366564907" value="false" />
<string name="org.telegram.key826702649_s"></string>
<int name="notify2_-1346720866" value="2" />
<boolean name="silent_-1127069572" value="false" />
<string name="org.telegram.key-1404277588_s"></string>
<int name="spam3_-1449317726" value="1" />
<boolean name="silent_-1070638809" value="false" />
<int name="spam3_-1221388827" value="1" />
<int name="notify2_-1363717298" value="2" />
<boolean name="silent_-1134531399" value="false" />
<int name="notify2_-1452321226" value="2" />
<int name="diditemo-1147391459" value="95" />
<int name="notify2_-1123180379" value="2" />
<int name="notify2_-1123340592" value="2" />
<int name="diditemo-1120840953" value="671" />
<string name="org.telegram.key-1058364321"></string>
<int name="notify2_-1138327678" value="2" />
<string name="org.telegram.key644204122_s"></string>
<int name="notify2_-1058364321" value="2" />
<int name="nextTosCheckTime" value="1561198884" />
<int name="diditem-1147391459" value="21442" />
<int name="spam3_-1075225279" value="1" />
<int name="diditemo200752145" value="-3" />
<int name="spam3_-1136693240" value="1" />
<string name="org.telegram.key-1083963611_s"></string>
<int name="notify2_-1094873662" value="2" />
<string name="org.telegram.key-1070638809_s"></string>
<boolean name="silent_-1238708706" value="false" />
<int name="notify2_-1467863848" value="2" />
<string name="org.telegram.key-1363717298_s"></string>
<boolean name="silent_-1094873662" value="false" />
<int name="spam3_200752145" value="1" />
<string name="org.telegram.key777000_s"></string>
<string name="org.telegram.key-1332601105"></string>
<int name="diditem-1075225279" value="1296" />
<int name="EnableAll2" value="0" />
<int name="spam3_777000" value="1" />
<int name="spam3_-1147514813" value="1" />
<int name="spam3_-1465895562" value="1" />
<int name="notify2_-1083963611" value="2" />
<int name="notify2_-1238708706" value="2" />
<string name="org.telegram.key-1404277588"></string>
<int name="diditemo-1482963590" value="255" />
<string name="org.telegram.key-1008063018_s"></string>
<int name="archivedStickersCount0" value="0" />
<int name="spam3_826702649" value="1" />
<int name="archivedStickersCount1" value="0" />
<int name="diditemo-1115111220" value="135" />
<int name="spam3_215206978" value="1" />
<boolean name="silent_-1467863848" value="false" />
<int name="notify2_-1136693240" value="2" />
<int name="spam3_-1114306967" value="1" />
<int name="notify2_636556753" value="0" />
<int name="dismissDate" value="1560249231" />
<int name="spam3_-1037167615" value="1" />
<int name="spam3_773503309" value="1" />
<int name="spam3_-1330052861" value="1" />
<int name="spam3_-1094873662" value="1" />
<int name="spam3_-1467863848" value="1" />
<int name="notify2_-1332601105" value="2" />
<boolean name="silent_-1058364321" value="false" />
<int name="EnableChannel2" value="0" />
<int name="notify2_-1366564907" value="2" />
<int name="spam3_-1058364321" value="1" />
<string name="org.telegram.key-1083963611"></string>
<int name="spam3_-1120288839" value="1" />
<int name="spam3_-1208669633" value="1" />
<boolean name="silent_-1208669633" value="false" />
<int name="spam3_-1146675158" value="1" />
<int name="notify2_-1116272386" value="2" />
<int name="spam3_-1123340592" value="1" />
<int name="spam3_-1109249098" value="1" />
<int name="notify2_-1134531399" value="2" />
<int name="spam3_-1147391459" value="1" />
<boolean name="silent_-1452321226" value="false" />
<int name="spam3_-1147558401" value="1" />
<int name="notify2_-1008063018" value="2" />
<int name="spam3_-1115111220" value="1" />
<int name="notify2_-1127069572" value="2" />
<int name="spam3_-1001767481" value="1" />
<int name="notify2_-1070638809" value="2" />
<string name="org.telegram.key-1096407797_s"></string>
<string name="org.telegram.key-1008063018"></string>
<string name="org.telegram.key826702649"></string>
<int name="spam3_459070976" value="1" />
<boolean name="askAboutContacts" value="true" />
<string name="org.telegram.key-1070638809"></string>
<int name="spam3_-1172303505" value="1" />
<int name="spam3_-1008420687" value="1" />
<string name="org.telegram.key-1147558401_s">c444f5f452062a465bdab093e40b0417</string>
<string name="org.telegram.key200752145"></string>
<int name="spam3_-1045490838" value="1" />
<int name="diditem-1120840953" value="5976" />
<string name="org.telegram.key773503309"></string>
<boolean name="silent_-1136693240" value="false" />
<int name="notify2_-1208669633" value="2" />
<int name="spam3_-1029023478" value="1" />
<boolean name="silent_-1120549898" value="false" />
<int name="diditemo-1075225279" value="346" />
<boolean name="EnableInAppPreview" value="false" />
<int name="EnableGroup2" value="0" />
<int name="spam3_-1238708706" value="1" />
<int name="notify2_-1147558401" value="0" />
<int name="spam3_-1061616576" value="1" />
<string name="org.telegram.key-1147558401">0channel-1147558401_3373524404048658363</string>
<string name="org.telegram.key200752145_s"></string>
<int name="spam3_-1142805440" value="1" />
<int name="notify2_-1120549898" value="2" />
<int name="spam3_-1098270440" value="1" />
<int name="spam3_-1120840953" value="1" />
<string name="org.telegram.key773503309_s"></string>
<int name="diditem200752145" value="19605" />
<int name="notify2_-1139909213" value="2" />
<boolean name="silent_-1075225279" value="false" />
<int name="spam3_-1363717298" value="1" />
<boolean name="silent_-1088528518" value="false" />
<int name="diditem-1088528518" value="3444" />
<int name="spam3_644204122" value="1" />
<boolean name="EnablePreviewGroup" value="true" />
<int name="spam3_-1040029844" value="1" />
<int name="diditemo-1147514813" value="580" />
<boolean name="silent_-1029023478" value="false" />
<boolean name="silent_-1096407797" value="false" />
<int name="spam3_-1404277588" value="1" />
<int name="spam3_-1096407797" value="1" />
<int name="spam3_-1235237937" value="1" />
<int name="notify2_-1088528518" value="2" />
<int name="spam3_-1070638809" value="1" />
<boolean name="silent_-1408220341" value="false" />
<boolean name="silent_636556753" value="false" />
<int name="notify2_-1096407797" value="2" />
<int name="spam3_-1088528518" value="1" />
<string name="org.telegram.key-1332601105_s"></string>
<int name="diditem-1115111220" value="956" />
<int name="diditem-1482963590" value="266" />
<string name="org.telegram.key-1040029844"></string>
<int name="notify2_-1075225279" value="2" />
<int name="spam3_-1268571449" value="1" />
<string name="org.telegram.key644204122"></string>
<boolean name="EnablePreviewChannel" value="true" />
<int name="notify2_-1221388827" value="2" />
<string name="org.telegram.key-1040029844_s"></string>
<string name="org.telegram.key-1096407797"></string>
<string name="org.telegram.key-1058364321_s"></string>
<boolean name="silent_-1147558401" value="false" />
<boolean name="EnablePreviewAll" value="false" />
<int name="spam3_-1091591879" value="1" />
<int name="spam3_-1138327678" value="1" />
<string name="org.telegram.key777000"></string>
<int name="spam3_-1308595305" value="1" />
<int name="spam3_-1008063018" value="1" />
<boolean name="silent_-1008063018" value="false" />
<boolean name="silent_-1363717298" value="false" />
<boolean name="silent_-1138327678" value="false" />
<int name="notify2_-1029023478" value="2" />
所以我正在测试txt文件,命令如下:
sed -i 's+"EnablePreviewAll" value="false"/>+"EnablePreviewAll" value="true"/>+' /storage/emulated/0/basel.txt
它没有给我一个错误,但是值完全没有变化。 (我使用具有根访问权限的Termux) (我复制了文本并将其命名为basel.txt进行测试)
答案 0 :(得分:0)
这可能对您有用(GNU sed):
sed -i '/EnablePreviewAll/s/false/true/' file
如果一行包含EnablePreviewAll
,则将false
替换为true
。