I have a file that has some text that looks like this
Some Text
1. More text
2. Different text
Final Text
I would like the remove the lines of text that start with the numbers.
Some Text
Final Text
I have tried to use cat file.txt | grep -Ev 1. > file2.txt
However it just removes lines from the file.
Thank you
agama
2
Try:
awk ' $1+0 == 0 ' input-file-name >new-file-name
Will remove any line that starts with a number other than zero.
cat some .txt
------
text begin
- algo
- otro
- algo mas
text end
------
sed -i 's/^[0-9].*$//g' some.txt |awk NF -
----
cat some.txt
text begin
text end
----------------
simple and practical
That worked great.
Thank you
Try this
cat <inpput file> | grep ^[a-z,A-Z] >> <ouputfile>
$ awk '!/^[0-9]/' inputfile
Some Text
Final Text
Command above print line only if there is no number in line.
$ cat aaa.txt
aaaaaaaaaaaaaaaaaa
1. sssssssssss
2. qqqqqqqqqqqqqqq
eeeeeeeeeeeeeee
333333333333333
$ grep -v ^[0-9] aaa.txt
aaaaaaaaaaaaaaaaaa
eeeeeeeeeeeeeee
for above scenario ..
$ grep -v "^[0-9]\." infile
aaaaaaaaaaaaaaaaaa
eeeeeeeeeeeeeee
333333333333333