I have a file like
1 0
2 0
3 1
3 0
4 0
6 1
6 0
. .
. .
. .
i need to eliminate values 3 0 and 6 0 in the same way there are such values in the whole file....but 3 1 and 6 1 shuld be present...
I have a file like
1 0
2 0
3 1
3 0
4 0
6 1
6 0
. .
. .
. .
i need to eliminate values 3 0 and 6 0 in the same way there are such values in the whole file....but 3 1 and 6 1 shuld be present...
Try this
sed -ir '/[3|6] [0]/d' file
Now the file will not contain the lines "3 0" and "6 0"
python
container = open('your_file_here').readlines() # load file info into variable container
container = [item[:3] for item in container] # remove trailing spaces or newlines
for item in container[:]: # loop over copy of the list
if item == '3 0' or item == '6 0':
container.remove(item)
open('your_file_here', 'w') # deletes and creates new copy of the file (blank)
final = open('your_file_here', 'a') # opens the blank file
for item in container:
final.write(item + '\n') # writes into the file
final.close() #closes the file
it's a bit convoluted, better option would be to use sed in bash