The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
search a pattern and if pattern found insert new pattern at the begining pitagi Shell Programming and Scripting 7 02-12-2009 10:27 PM
modify a particular pattern starting from second line of the search pattern imas UNIX for Dummies Questions & Answers 1 10-12-2008 02:19 PM
modify a particular pattern starting from second line of the search pattern imas UNIX for Dummies Questions & Answers 2 10-12-2008 12:30 PM
SED Search Pattern and Replace with the Pattern racbern Shell Programming and Scripting 4 03-15-2008 05:59 AM
Search file for pattern and grab some lines before pattern frustrated1 Shell Programming and Scripting 2 12-22-2005 03:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-17-2009
anjas anjas is offline
Registered User
  
 

Join Date: Mar 2009
Location: Bali, Indonesia
Posts: 17
Search for very spesific pattern with less

Hi,

I want to search a certain pattern with less command in a files. For examples, I have a files with this entry:

POLAR xx
POLARX xc
POLARXI x1
POLARZZZY vb
POLARLLLLLLL ee
POLARIIIIISSSSSID xx

I want to search for the lines, which only contains 'POLAR' pattern. If I use the usual '/ (pattern)' command, it would show all entry in the files. I know, if I use the 'grep -P "\t(pattern)\t" ' command, it would give only the first line. However, could I use the same method in 'less'? or is there any other way?
Thank's
  #2 (permalink)  
Old 03-17-2009
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 208
my less version accepts the regex 'whole word' markers \<word\>

Code:
$ less --version
less 418
Copyright (C) 1984-2007 Mark Nudelman

so now your search in the above file would be

Code:
/\<POLAR\>

Closed Thread

Bookmarks

Tags
pattern, search, spesific

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0