Quantcast
Channel: how to keep only lines with specific word - Unix & Linux Stack Exchange
Browsing all 3 articles
Browse latest View live

Answer by Praveen Kumar BS for how to keep only lines with specific word

Below command you can use Tested and worked fine awk '{for(i=1;i<=NF;i++) {if (($i == "word1") || ($i == "word2")) {print $0}}}' filename

View Article



Answer by waltinator for how to keep only lines with specific word

Read man grep. Do something like: grep -w 'word' the_file grep -E -w 'word1|word2' the_file

View Article

how to keep only lines with specific word

I have a huge text with multiple columns and rows and I want to keep the lines that consist one specific word (no matter in which column)... (if possible I also like to have two separate specific...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images