LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   awk - print lines length 10 chars and contain specific word (https://www.linuxquestions.org/questions/linux-newbie-8/awk-print-lines-length-10-chars-and-contain-specific-word-4175617127/)

freeroute 11-07-2017 06:30 AM

awk - print lines length 10 chars and contain specific word
 
I would like search using awk, 10 chars length words that contain specific word.

This command print 10 chars length words only:
Code:

awk 'length==10 {print $0}' /usr/share/wordlists/rockyou.txt
How can I find from these that contains word e.g.: "winter"?
e.g.: winter0123, 234winter?

This command is bad:
Code:

awk '/winter/ length==10 {print $0}' /usr/share/wordlists/rockyou.txt
Thank you.

pan64 11-07-2017 06:59 AM

insert && between conditions

freeroute 11-07-2017 07:06 AM

Great.:) Thank you.


All times are GMT -5. The time now is 08:17 PM.