_kida
1
Hello. I'm trying to delete the lines of a file does not contain the letter "T " (for example) at position 26.
So far, I could only print the result:
awk '{if (substr ($ 1,1,26)! ~ / T /) print}' file.txt
How I can do to eliminate the lines that meet this condition?
Help please. Thanks.
There are many many ways you could to this. With man grep (linux), for instace:
grep -v '^.........................T' inputfile
(there should be 25 ".")
With awk, I'd:
awk 'substr($0, 26, 1) != "T"' inputfile
I am sure others will come up with different methods.
1 Like
# sed '/^.\{25\}\(T\).*/d' infile
That means print the lines that do, doesn't it?
awk '$26=="T"' FS= file.txt
sed '/.\{25\}T/!d' file.txt
grep '.\{25\}T' file.txt