- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Sed query
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-27-2007 11:55 PM
03-27-2007 11:55 PM
I just want to use sed as a search function on a file instead of grep.
I want to seach for all instances of "Authentication Failure" in the syslog.log file.
I know how to search and replace but can't seem to do the search.
OS is HP-UX
Any help is most appreciated.
Thanks,
N
Solved! Go to Solution.
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 01:03 AM
03-28-2007 01:03 AM
Re: Sed query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 02:08 AM
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 02:08 AM
03-28-2007 02:08 AM
Re: Sed query
# sed -ne '/Authentication Failure/p' /var/adm/syslog/syslog.log
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 02:09 AM
03-28-2007 02:09 AM
Re: Sed query
> on a file instead of grep.
Why?
Q: I want to use a hammer as a screwdriver,
but it keeps damaging my screws. What should
I do?
A: Use a screwdriver.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 02:12 AM
03-28-2007 02:12 AM
Re: Sed query
how about:
sed -n "1,$ s/Authentication Failure/Authentication Failure/p" data.lis
what is wrong with grep ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 02:37 AM
03-28-2007 02:37 AM
Re: Sed query
I would have to agree with Steven, too. If you sole objective is to find lines where you match a pattern, then 'grep' is probably the simplest tool to use.
The value of 'sed' (or 'awk' or Perl) begins to appear if you want to match *ranges* of lines with patterns or when you want to extract pieces of lines that have a matching pattern. For example, if you wanted to print lines in a file that began with the pattern 'begin' and ended with the pattern 'end', using 'sed' you could do:
# sed -ne '/^begin/,/^end/p' file
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 03:07 AM
03-28-2007 03:07 AM
Re: Sed query
thanks they all work. I don't really want to use Sed at all , Grep is fine for me but am doing some "exercises" on grep and that was one of the questions!! Hope i'm not wasting any valuable admin time.
N
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 03:34 AM
03-28-2007 03:34 AM
Re: Sed query
The question is not a waste of our time, but points for the efforts to respond *are* appreciated.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 03:41 AM
03-28-2007 03:41 AM