我正在尝试对行中第一个句点之前所有带有字母a
的行进行grep。
这是一个示例文件:
test123a.hello
example.more-test-a.xyz
stacka.tester.this
nothing.nothing.nothing
在上面的示例中,我想grep
这两行:
test123a.hello
stacka.tester.this
这是我尝试过的:
grep ".*a\." test.txt
这是我想要的两行,但是我也不想得到这行,因为a
在第二个句号的前面,而不是在第一个句号的前面:
example.more-test-a.xyz
如何将其限制为仅在第一个期间之前获得a
的行?