LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-07-2017, 05:30 AM   #1
freeroute
Member
 
Registered: Jul 2016
Location: Hungary
Distribution: Debian
Posts: 69

Rep: Reputation: Disabled
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.

Last edited by freeroute; 11-07-2017 at 05:58 AM.
 
Old 11-07-2017, 05:59 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,103

Rep: Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148Reputation: 4148
insert && between conditions
 
1 members found this post helpful.
Old 11-07-2017, 06:06 AM   #3
freeroute
Member
 
Registered: Jul 2016
Location: Hungary
Distribution: Debian
Posts: 69

Original Poster
Rep: Reputation: Disabled
Great. Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find a specific word between two lines having same another word.. say_hi_ravi Programming 4 04-18-2013 06:37 PM
Read lines after a specific word. Kashif_Bash Programming 10 04-26-2012 04:06 AM
Text file manipulation: selecting specific lines/columns using awk and print CHARL0TTE Linux - Newbie 2 02-27-2010 02:40 AM
print second word in 1st line along with 5th word in all the lines after the first bangaram Programming 5 08-31-2009 03:42 AM
Another awk question: un-word-wrap lines David the H. Linux - General 16 12-16-2007 01:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration