- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Modify file
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
тАО06-25-2010 11:58 AM
тАО06-25-2010 11:58 AM
Thanks,
Allan
1
Solved! Go to Solution.
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2010 12:32 PM
тАО06-25-2010 12:32 PM
Re: Modify file
the file, it's hard to guarantee that
anything simple won't corrupt the data, but
you could try something simple with "sed":
$ echo '127
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2010 12:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2010 01:03 PM
тАО06-25-2010 01:03 PM
Re: Modify file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-25-2010 04:12 PM
тАО06-25-2010 04:12 PM
Re: Modify file
a pipe, too?
> [...] 's/^[0-9]*//'
Leaves the white space.
> "s/[0-9]* //"
Expects at least one space, and removes one.
's/^[0-9]*[ \t]*//'
(where "\t" may need to be a literal Tab
character)
Removes all white space (space and or tab
characters) after the number).
As usual, many things are possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-29-2010 11:17 AM
тАО06-29-2010 11:17 AM
Re: Modify file
I just read Steve's posting, and his is more correct, in that he is making sure that the numbers you're pulling out are at the beginning of the line while my sed example does not.
What I put as:
sed -e "s/[0-9]* //"
Should be like Steve's example and read:
sed -e "s/^[0-9]* //"
That carat symbol "^" tells that sed command to find a numeric sequence at the start of a line, which is more correct to what you're needing. My suggested code from a few days back would remove the ones at the beginning of the line, but also in other places as well.
Please make sure to add the carat "^" symbol before the brace "[" character.