给出以下文件:
this is some words
and this one too<div>
<html></html>
and more words 123
Caps to begin
ASDFSDFSDF
以下两个命令可以正常运行:
grep -i '[:alpha:]' testfile
给出
this is some words
and this one too<div>
<html></html>
and more words 123
Caps to begin
ASDFSDFSDF
和
grep '[:alpha:]' testfile
给出
this is some words
and this one too<div>
<html></html>
and more words 123
Caps to begin
但
grep '^[:alpha:]' testfile
and this one too<div>
and more words 123
和
grep -i '^[:alpha:]' testfile
and this one too<div>
and more words 123
ASDFSDFSDF
应该确保该行以字母数字开头的插入符号已经搞砸了所有内容。为什么'这是一些单词'行和'开始上限'行没有匹配? 这是在Mac Lion上使用bash。
答案 0 :(得分:0)
我相信你所寻找的是:
grep '^[[:alpha:]]' testfile
grep -i '^[[:alpha:]]' testfile