I want to write a script using Oscam Cardsharing server
this is my test:
cat oscam.log | grep "error"
sample output:
2018/10/17 16:43:07 5C94A12E p (cccam) cccam(r) test.dyndns.org: login failed, error
Once I've found an error, I need to remove its information inside another file :
oscam.server
[reader] label = test.dyndns.org
protocol = cccam
device = test.dyndns.org,12000
key = 0102030405060708091011121314
user = 12345
password = 12345
inactivitytimeout = 30
group = 1
cccversion = 2.1.2
cccmaxhops = 0
cccmindown = 1
ccckeepalive = 1
blalbal
blalblalb
blalblalb
lablalb
I need to delete those " test.dyndns.org
" lines that matched. I would like to keep only the following :
blalbal
blalblalb
blalblalb
lablalb
So far, I've tried the following code :
awk '/test.dyndns.org/{while(getline && $1 != ""){}}1' oscam.server
#output is :
[reader]
blalbal
blalblalb
blalblalb
lablalb
But the line [reader]
is still present. What could I do to remove the block entirely?
i dont know how variable in perl because will be random url that contains words or only numbers i didnt prefer this method i gave an example
perl -sp0e 's/\[reader\]((?!\n\n).)*\Q$input\E((?!\n\n).)*((\n\n)|(\n?\Z))//sig' -- -input="<DESIRED INPUT HERE>" oscam.server