- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- grep and regexp
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 02:07 PM
03-04-2003 02:07 PM
I have a file that contains words "The", "There", "These", etc. but
grep \
Any ideas?
Shawn
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2003 02:09 PM
03-04-2003 02:09 PM
Re: grep and regexp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2003 08:10 PM
03-09-2003 08:10 PM
Re: grep and regexp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2003 09:57 PM
03-09-2003 09:57 PM
Re: grep and regexp
does this help. it is on bash. btw, what shell are u working on.
++++++++++++
cat a.txt
It seems that word delimiter \< and \> doesn't seem to work as expected.
I have a file that contains words "The", "There", "These", etc. but
grep \
Any ideas?
Shawn
[balajin@penguin tmp]$ grep 'rk\>' a.txt
It seems that word delimiter \< and \> doesn't seem to work as expected.
[balajin@penguin tmp]$ grep '\
I have a file that contains words "The", "There", "These", etc. but
++++++++++++
Regards
Balaji
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 01:49 AM
03-10-2003 01:49 AM
Re: grep and regexp
The question seems to be, what do you exect from "\<"... and why do you expect it? :-)
The grep command understands RE and ERE (with -E) as described in rexexp(5).
You could use this ERE:
grep -E '([[:space:]]|^)T'
This matches any "T" at the beginning of the line (^) or (|) being preceded by a whitespace ([[:space]]).
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 03:13 AM
03-10-2003 03:13 AM
Re: grep and regexp
Modern egrep's support this feature (grep does not)
# egrep '\
This feature is one of the escapes that is not normalized accross the pattern matching programs. vi uses \<, as does egrep. emacs, .net, and sun's java package support the perl \b escape (emacs also supports \< and \>, but emacs lacks a decent user interface)
If you compile grep/egrep/fgrep yourself from the source, and you already have PCRE (perl compatible regular expressions) installed, it also supports PCRE like regex syntax through -P:
lep a5:/pro/local/bin 112 > grep --help
Usage: grep [OPTION]... PATTERN [FILE] ...
Search for PATTERN in each FILE or standard input.
Example: grep -i 'hello world' menu.h main.c
Regexp selection and interpretation:
-E, --extended-regexp PATTERN is an extended regular expression
-F, --fixed-strings PATTERN is a set of newline-separated strings
-G, --basic-regexp PATTERN is a basic regular expression
-P, --perl-regexp PATTERN is a Perl regular expression
Enjoy, have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 03:42 AM
03-10-2003 03:42 AM
Re: grep and regexp
For the start of the sentence :
grep ^The.* /tmp/2
Somewhere in the middle :
grep the.* /tmp/2
Regs David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 08:46 AM
03-10-2003 08:46 AM
Re: grep and regexp
I know most of you have way passed the level beyond the certificate books. What I was doing was to understand the materials presented in Rehman's book.
Page 95: Use of the Word Delimeters \< and \>
It simply didn't work. reason I could think of was that the system version I am running is not the latest:
$uname -r
B.10.20
To answer other's question, I am using posix shell.
As a separate topic, although I found the book is overall well written, some sentences were a bit hard to understand. For example,
Page 108 Changing the Owner and Group of a File.
...
"Any user other than the owner of the file can't change ownership of a file, except the superuser."
Doesn't this mean
"Only the owner and the superuser can change the ownership of a file"?
Thanks for all your responses. I will give you points when I finish next chapter. :-)
Shawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 08:58 AM
03-10-2003 08:58 AM
Re: grep and regexp
If you issue grep '\
As Merijn wrote, _some_ grep implementations allow that... but not the HP-UX versions. Even not the latest ones.
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 09:08 AM
03-10-2003 09:08 AM
Re: grep and regexp
Shawn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2003 11:51 AM
03-10-2003 11:51 AM
Solution>Any user other than the owner of the file can't change ownership of a file, except the superuser."
>Doesn't this mean
>"Only the owner and the superuser can change the ownership of a file"?
The Rahman book is good, but sometimes (as you point out) his use of English is strained. The answer is: yes--only the owner of a file and/or the superuser can change the permission or ownership of that file.
The book has other areas of difficulty: pay STRICT attention to the networking theory. It almost doesn't cover it in the depth asked on the test.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2007 09:49 PM
06-25-2007 09:49 PM
Re: grep and regexp
On 11.11, grep has a new -w option to do word searches.