- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Sed Question
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
04-03-2008 10:55 AM
04-03-2008 10:55 AM
Sed Question
Abc123
Abc1234
000\Abc1235
101\Abc1236
X01\Abc1237
I want to strip out anything that is before the "\" so the output would be,
Abc123
Abc1234
Abc1235
Abc1236
Abc1237
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2008 11:45 AM
04-03-2008 11:45 AM
Re: Sed Question
Say,m your lines are saved in file ZZZ.Then simply run:
# sed -e 's/^.*\\//g' ZZZ
The result is:
Abc123
Abc1234
Abc1235
Abc1236
Abc1237
Cheers,
VK2COT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2008 01:19 PM
04-03-2008 01:19 PM
Re: Sed Question
And alternative using awk: awk -F\\ '{print $NF}' ZZZ
And if only data up to the first \ needs to be stripped (unlikely):
sed -e 's/^[^\\]*\\//g' x
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2008 09:59 PM
04-03-2008 09:59 PM
Re: Sed Question
sed -e 's/^[^\\]*\\//g' x
I assumed you could just remove the "g" but that doesn't work. It seems in your and Dusan's answer, that "g" isn't needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2008 10:13 PM
04-03-2008 10:13 PM
Re: Sed Question
Sorry. I just cut & paste Dusan first to make sure that worked, then modified.
Hein