用于查找特定单词的sed命令

时间:2017-07-22 17:54:40

标签: linux sed command-line

//ask.census.gov/
//ask.census.gov/
//business.usa.gov/
//directorsblog.blogs.census.gov/
//public.govdelivery.com/accounts/USCENSUS/subscriber/new
//twitter.com/uscensusbureau
//www.calendarwiz.com/calendars/calendar.php?crd=cens1sample&cid[]=31793    
//www.census.gov/2017censustests    
//www.census.gov/2017censustests/    
//www.census.gov/2020census    
//www.census.gov/2020census    
//www.census.gov/2020census/
//www.census.gov/about.html    
//www.census.gov/about.html

我希望使用sed命令

中包含www的行

1 个答案:

答案 0 :(得分:1)

使用sed:

sed -ne '/\/www\./p' file

或者grep:

grep '/www\.' file

或者awk

awk '/\/www\./' file