- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Escaping the % from values with any number of digi...
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
тАО01-05-2010 02:42 PM
тАО01-05-2010 02:42 PM
I want to escape only the % from the below values irrespective of the number of digits.
I tried echo "10%" | grep -v %, etc but its suppressing the whole. Also i tried cut -c, but its used to cut based on the list of characters like cut -c 1-2 extracts first 2, etc..
10%
120%
1234%
12345%
.....
.....
and so on
Is there any single command to escape the % irrespective of the number of digits?
Thanks,
Ramkumar A.
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 02:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 02:58 PM
тАО01-05-2010 02:58 PM
Re: Escaping the % from values with any number of digits
actually i don;t know if you like to remove only this character % from the lines ??? if yes use this :
this is your example :
echo "10%" | sed -e 's/%//g'
if you number with your character % are in a file you could use this.
sed -e 's/%//g' file.name
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 02:58 PM
тАО01-05-2010 02:58 PM
Re: Escaping the % from values with any number of digits
sed -e "s/\([0-9][0-9]*\)%/\1/"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 02:58 PM
тАО01-05-2010 02:58 PM
Re: Escaping the % from values with any number of digits
That's what i was looking for and your solution is perfect. Thank you very much.
Thanks,
Ramkumar A.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 03:01 PM
тАО01-05-2010 03:01 PM
Re: Escaping the % from values with any number of digits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2010 05:24 PM
тАО01-05-2010 05:24 PM