除电子邮件地址外,如何做到“编辑”删除其他一切。
db dump: someusername ::: kRW...0fPc ::: $2a$10$...aucvkDt86 ::: joesmith@gmail.com
除电子邮件地址外,如何做到“编辑”删除其他一切。
db dump: someusername ::: kRW...0fPc ::: $2a$10$...aucvkDt86 ::: joesmith@gmail.com
是否有必要打耳? gr什么? 这里,请你告诉你:
$ cat dbdump.txt
db dump: someusername ::: kRW...0fPc ::: $2a$10$...aucvkDt86 ::: joesmith@gmail.com
another line with two e-mail addresses <test@example.com> on it -- bob@example.org
$ grep -EiEio [A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4} dbdump.txt
joesmith@gmail.com
test@example.com
bob@example.org
<代码>-o只字标出对应部分,即电子邮件地址。 -i
使对配对案不敏感。 甚至在同一条线上发现了多个电子邮件地址。
<><>Edit>: 页: 1 页: 1 还将发挥作用......
这要求德国国籍<代码><>。
sed -r s/[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/
&
/ig;s/(^|
)[^@]*(
|$)/
/g;s/^
|
$//g;/^$/d inputfile
如果每行有一个电子邮件地址,则以下任何事项都不会发生。 如果不止一次,它只能显示最后一行。 它还赢得了没有有效电子邮件地址的线索。
sed s/^.* ([^@ ]+@[^ ]+) ?.*$/1/
$ cat dbdump
this line with no valid @ email address is untouched
::: a0$...aucvkDt86 ::: joesmith@gmail.com
::: a0$... foo@example.com db dump: someusername :::
$ sed s/^.* ([^@ ]+@[^ ]+) ?.*$/1/ ./dbdump
this line with no valid @ email address is untouched
joesmith@gmail.com
foo@example.com
<代码>:
$ echo "db dump: someusername ::: kRW...0fPc ::: $2a$10$...aucvkDt86 ::: joesmith@gmail.com"|sed s/.*::: // joesmith@gmail.com
缩略语
$ echo "db dump: someusername ::: kRW...0fPc ::: $2a$10$...aucvkDt86 ::: joesmith@gmail.com"|awk {print $NF}
EDIT:鉴于你的评论中的新内容,我们非常难以做你要求做的事情,而没有任何规律。 参看Syntax部分:
标准指出,例如1$%3{C}@example.com
是有效的电子邮件地址(如:不)。 您甚至可以引用(本条的例子为<代码>)。 John Doe@example.com。 因此,按照标准,几乎不可能承认有效的电子邮件。
如果你限制你的搜寻,你可以这样说。 1. 初步抽取载有<代码>@的线路:
cat your-file.txt|grep @
然后是上述一些。 你甚至可以做这样的事情:
$ echo "garbage John.Doe123@example.com garbage"|sed s/[^@]* ([a-zA-Z0-9.]*@[^ ]*).*/1/
John.Doe123@example.com
注:以上假设如下:
local-part
(all before @
) contains only letters (lower- or upper-case), digits and a dot([a-zA-Z0-9.]
)
I can t figure how to tell sed dot match new line: echo -e "one two three" | sed s/one.*two/one/m I expect to get: one three instead I get original: one two three
I d like to use the search pattern in the output part of a sed command. For instance, given the following sed command: sed /HOSTNAME=/cHOSTNAME=fred /etc/sysconfig/network I d like to replace the ...
I have text files generated by one of my tools with structure shown below. 1 line text (space) multiple lines text (space) multiple lines text nr 2 ----------------------------------------------------...
I have a directory that looks like this: pages/ folder1/ folder1.filename1.txt folder1.filename2.txt folder2/ folder2.filename4.txt folder2.filename5.txt ...
I m attempting to write a bash script to parse out the following log file and give me a list of CURRENT players in the room (so ignoring players that left, but including players that may have rejoined)...
I see lots of examples and man pages on how to do things like search-and-replace using sed, awk, or gawk. But in my case, I have a regular expression that I want to run against a text file to extract ...
I d like to insert <?php include_once( google_analytics.php ); ?> before the closing body tag of about 100 php files. Unfortunately the person who made the site didn t make a header or ...
I am issuing a sed replace on a line, trying to extract a particular floating-point value, but all that appears to be matched is the right-side of the decimal Text Line: 63.544: [GC 63.544: [DefNew: ...