- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to remove or replace whitespace from file in V...
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
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
тАО09-29-2008 01:25 PM
тАО09-29-2008 01:25 PM
how to remove or replace whitespace from file in VI editor?
how to remove or replace whitespace from file in VI editor?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2008 01:40 PM
тАО09-29-2008 01:40 PM
Re: how to remove or replace whitespace from file in VI editor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2008 01:45 PM
тАО09-29-2008 01:45 PM
Re: how to remove or replace whitespace from file in VI editor?
I assume you want to remove *trailing* whitespace (spaces and/or tabs) from the end of lines:
%s/[\s\t]*$//
...where '\s' is a space-character and for '\t' type a tab character.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2008 03:04 PM
тАО09-29-2008 03:04 PM
Re: how to remove or replace whitespace from file in VI editor?
tr -d '[:blank:]' myfile
Redirect the output into a new file if you need to save the results. To get rid of spaces, tabs and LF characters, use:
tr -d '[:space:]' myfile
For other space manipulation, you can reduce all strings of more than one space to a single space with:
tr -s '[:space:]' myfile
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-29-2008 10:15 PM
тАО09-29-2008 10:15 PM
Re: how to remove or replace whitespace from file in VI editor?
Open your file in vi
at vi command prompt :
type
:1,$s///gp
Suraj