- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ksh help: to remove all occurrences of "/strin...
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
тАО07-12-2014 02:28 PM
тАО07-12-2014 02:28 PM
ksh help: to remove all occurance of "/string" from every line in the file
There are multiple lines in a file, and all look like the following:
f1:string1/string2 f2:string3/string4
f3:string5/string6 f4:string7/string8
....
I wanted to all characters with such format of "/stringx", in cluding / in the file. Would you please help me out?
Thank you!
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2014 03:29 PM - edited тАО07-12-2014 03:31 PM
тАО07-12-2014 03:29 PM - edited тАО07-12-2014 03:31 PM
Re: ksh help: to remove all occurrences of "/string" from every line in the file
You could use sed:
sed -e 's:/string.::g' file > file.new
I'm removing that arbitrary "x" char too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2014 06:59 PM - edited тАО07-12-2014 07:00 PM
тАО07-12-2014 06:59 PM - edited тАО07-12-2014 07:00 PM
Re: ksh help: to remove all occurrences of "/string" from every line in the file
I did not make myself clear.
/stringx, string could be any combination of of any characters or digits, it is not all the same. so, for instance,
/string1 could be "/asdbas_agd_sadf9", /string2 could be "/juhsdf_asb8bsd"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2014 08:34 PM
тАО07-12-2014 08:34 PM
Re: ksh help: to remove all occurrences of "/string" from every line in the file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2014 10:30 PM - edited тАО07-14-2014 04:53 AM
тАО07-12-2014 10:30 PM - edited тАО07-14-2014 04:53 AM
Re: ksh help: to remove all occurrences of "/string" from every line in the file
>string could be any combination of of any characters or digits
So you want to remove any combination after "/" to a space or newline?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2014 06:01 AM - edited тАО07-13-2014 06:22 AM
тАО07-13-2014 06:01 AM - edited тАО07-13-2014 06:22 AM
Re: ksh help: to remove all occurrences of "/string" from every line in the file
I wanted to remove, not replace, for instance:
f1:anycharactersordigits/anycharactersdigits f2:anycharactersordigits/anycharactersordigits
f3:anycharactersordigits/anycharactersdigits f4:anycharactersordigits/anycharactersordigits
....
so, i wanted to remove "/anycharactersdigits" from every line, including "/".
so, they will become the following:
f1:anycharactersordigis f2:anycharactersordigits
f3:anycharactersordigis f4:anycharactersordigits
any characters contain letters digits, "-", or "_", no space.
f1, f2, f3.. contains any characters, digits, "-", or "_" as well, no space.
thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2014 10:12 AM
тАО07-13-2014 10:12 AM