text processing - How to delete the lines from a file that do not contain dot? - Ask Ubuntu
i have file contains data including urls. there various lines not urls. how can remove them using ubuntu terminal commands?
here sample file reference: sample data
com.blendtuts/s °= com.blengineering.www/:http ±= i want have output :
com.blendtuts/s com.blengineering.www/:http the unwanted lines not have dot. hence, want remove lines without dots
one way sed
sed '/\./!d' file /\./match literal dot (escaped\because otherwise.matches character)!ddelete except matched pattern
if want edit file in place, add -i command after testing. (you can add .bak -i flag sed -i.bak ... create local backup of file.)
sed -i '/\./!d' file
Comments
Post a Comment