I cannot seem to figure out how to delete these lines.
In VIM, I tried the following and it did not execute:
:%s/[0-9]{4}\-[0-9]{2}\-[0-9]{2}/d
Then I get this error: pattern not found.
I can do the following and get results:
egrep '[0-9]{4}\-[0-9]{2}\-[0-9]{2}' file
This prints out:
2006-12-18
2007-02-05
2007-02-13
2007-03-06
2007-03-13
2007-04-03
2007-04-15
2007-04-16
2007-04-24
2007-05-18
2007-06-14
2007-07-15
2008-05-14
2008-05-20
2008-06-03
2008-06-10
2008-06-11
2008-06-19
2008-06-25
2008-07-15
2008-07-21
2009-10-21
2010-07-02
In VIM, I tried adding a ^
to the beginning of the pattern and a $
to the end and it still did not recognize the pattern.
I am using VIM on Mac 10.11.2 (15C50) El Capitan using Terminal.
sed gives me issues as well. I tried:
sed -i '/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/d' file
I get the error:
sed: 1: "file": command c expects \ followed by text
I tried sed with or without -i
, using "sed 's/pattern//g' file"
, and sed -e
, but none of these did anything to the file.
I also tried replacing [0-9]
with [:digit:]
, but that did not work either:
sed -i '/[:digit:]{4}\-[:digit:]{2}\-[:digit]{2}/d' file
The results were the following error:
sed: 1: "file": command i expects \ followed by text
Please help. Thank you!