- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Remove /dev/ from the large file using sed
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
Discussions
Discussions
Forums
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
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
тАО11-20-2010 11:08 AM
тАО11-20-2010 11:08 AM
I am trying to remove /dev/ from the file using sed and no luck getting that done.
If someone can hel me that will be very much appreciated.
at test.lst | sed -e 's/\/dev//' >>> Strill leaves the leading "/" and not able to remove using sed.
trying to remove /dev/ from the file
Regards,
M
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2010 11:15 AM
тАО11-20-2010 11:15 AM
Solution$ cat test.lst
/dev/some
/dev/thing
/dev/some
/dev/thing
/dev/else
Here is what I did:
$ sed -e 's/\/dev\///g' test.lst
some
thing
some
thing
else
If you want to remove '/dev/' from the file you have to include the leading and trailing '/' characters and escape them both with the '\'.
Also note that you don't have to cat the file and pipe it to sed. That wastes a process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2010 11:44 AM
тАО11-20-2010 11:44 AM
Re: Remove /dev/ from the large file using sed
"/" may be less special than you think.
$ echo '/dev/thing' | sed -e 's|/dev/||'
thing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2010 11:59 AM
тАО11-20-2010 11:59 AM
Re: Remove /dev/ from the large file using sed
When you don't use the '/' as the delimiter, very true. In Steven's example above note that he used the '|' (pipe) symbol rather than forward slashes in the sed command. The eliminated the need for escaping the slashes in '/dev/'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2010 12:09 PM
тАО11-20-2010 12:09 PM
Re: Remove /dev/ from the large file using sed
U guys are DE Man !!!!! :)
Regards,
MJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-20-2010 05:05 PM
тАО11-20-2010 05:05 PM