- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Vi or editor command need your help
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
Forums
Discussions
Discussions
Discussions
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
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-25-2007 06:17 PM
11-25-2007 06:17 PM
I have a file (2570 line ) this is a part of it:
=======
44890236177031.300001 VN0010002 LD0714500064 61925 VND 20070901 51001 21054
144890236177031.320001 VN0010002 LD0714500065 61925 VND 20070901 51001 21054
144890236177031.340001 VN0010002 LD0714500065 61925 VND 20070901 51001 21054
144890236177031.360001 VN0010002 LD0714500065 61925 VND 20070901 51001 21054 PAGE 7 09:09:51 21 NOV 2007
144890236177040.030001 VN0010006 LD0714600019 100000 VND 20070901 51001 21050
144890236177041.000001 VN0010006 LD0714600019 100000 VND 20070901 51001 21050
144890236177041.020001 VN0010011 LD0714600024 161667 VND 20070901 51001 21060
144890236177041.040001 VN0010011 LD0714600024 161667 VND 20070901 51001 21060 PAGE 9 09:09:51 21 NOV 2007
144890236177056.160001 VN0010002 LD0714600070 123850 VND 20070901 51001 21054
144890236177056.180001 VN0010002 LD0714600070 123850 VND 20070901 51001 21054
144890236177056.200001 VN0010002 LD0714600071 74310 VND 20070901 51001 21054
PAGE 10 09:09:51 21 NOV 2007
=====
I want to replace all character since "PAGE" to the end of line by blank or space character.
It is hard with me because of the number of page
for ex: PAGE 8, PAGE 9, PAGE 10 and so on
How to do it ???
pls help
Thank
Solved! Go to Solution.
- Tags:
- vi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2007 08:00 PM
11-25-2007 08:00 PM
Re: Vi or editor command need your help
i don't know how to replace these characters but you can suppress them by the following command under vi:
:%s/PAGE .*//
whith sed, you can test something similar:
sed 's/PAGE .*//' filename
--
Regards,
Cedrick Gaillard
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2007 08:00 PM
11-25-2007 08:00 PM
Re: Vi or editor command need your help
Use sed:
sed 's/PAGE.*//'
Regards,
Kasper
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2007 01:54 AM
11-26-2007 01:54 AM
SolutionIf you want to restrict which lines, you can replace the "%" by two marks: 'a,'b
Or a mark and ".": 'a,.
If you think "PAGE" may be on other lines and "PAGE" starts at the beginning, you can anchor it: %s/^PAGE .*$//
You of course can just delete those lines:
:g/^PAGE "/d
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2007 02:59 AM
11-26-2007 02:59 AM
Re: Vi or editor command need your help
grep -v ^PAGE infile > outfile
would remove all lines beginning w/ PAGE in first character pos
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2007 03:23 AM
11-26-2007 03:23 AM
Re: Vi or editor command need your help
I know how to fix from your reply
The answer is %s/^PAGE .*$//
points is assigned and thread is closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2007 03:25 AM
11-26-2007 03:25 AM
Re: Vi or editor command need your help
Regards
Tienna