Answer the question
In order to leave comments, you need to log in
How to delete lines with certain word and character combination in linux?
Tell me how to delete lines in linux containing a certain word and a combination of characters.
Such command deletes normally.
sed -i '/\"track":"3.00"/d' 1.txt
But I need to delete the same lines from 3 to 100.
I tried this. Does not work.
sed -i '/\"track":"/[3-100]/.00"/d' 1.txt
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
something like this
awk '!/"track":"([3-9]|([1-9][0-9])|100).00"/' 1.txt
awk -i inplace '!/"track":"([3-9]|([1-9][0-9])|100).00"/' 1.txt
You can stupidly write a loop on the bash with iteration from 3 to 100 and issuing the appropriate command.
https://regex101.com/
Compose a regexp, check for a match below.
Obviously, you need to add one to three digits to the capture group.
If the entire lines are straight, thencat file | grep -v выражение > file2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question