- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Vi question
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
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
01-20-2007 12:06 PM
01-20-2007 12:06 PM
Vi question
-------------
While editing in vi I most often face a situation when I have to do a shift-J to join lines .
Question:
----------
How can I determine which lines need to be joined instead of scrolling and looking over these lines within a long file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2007 12:49 PM
01-20-2007 12:49 PM
Re: Vi question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2007 06:41 PM
01-20-2007 06:41 PM
Re: Vi question
If there is some criteria for joining lines, you may be able to write a shell script that reads from the original file and creates a second.
There must be some data that a machine can identify, otherwise your current methodology is all you have.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2007 02:41 PM
01-21-2007 02:41 PM
Re: Vi question
Solve that, then you don't need to write a clever script to fix this...
Bottom line - you will have to go through the entire file...
You could do a
:set nu
in vi to see line numbers - that way you can scroll a page at a time.
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2007 12:25 AM
01-22-2007 12:25 AM
Re: Vi question
OK Let's call your file "myfile.txt." Let's have our formated file called "myfile.formated."
1. cat myfile.txt | sed G | adjust -m72 > myfile.formated
2. vi myfile.formated.
3. :g/^$/de
4. :wq!
Is this what you were looking for?
thingy ......explanation about it.
cat myfile.txt ....spit out the text.
sed G ....double space the file.
adjust -m72 ......WRAP that text when it gets to column 72. (Just like in typing class).
:g/^$/de ......
: ......ed mode
g ......for all lines
/^$/ ......where it is a blank line
de ......delete that line
:wq! ....... Write, Quit, and I really mean it.
Now file myfile.formated is probably what you wanted. Do a man page on adjust for more details.
Now what if you want it to be 200 characters wide and in 3 columns? Oh I think it would be time for perl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2007 01:13 AM
01-22-2007 01:13 AM
Re: Vi question
What criteria are you using to decide which lines should be joined together?
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2007 05:52 AM
01-22-2007 05:52 AM
Re: Vi question
I set up a macro in '.exrc' like this:
map ^P {!}adjust -m72
With text on the screen, put the cursor anywhere in the paragraph, type 'CTRL-p' and the whole paragraph adjusts.
Starting at the bottom, hold down ctrl-p, and it will adjust paragraphs all the way to the top.
I'm curious about the "... most often face ...", which makes it sound like that's your most-used operation. What sort of text is it? Regular text, source code, data in text, ...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2007 06:00 AM
01-22-2007 06:00 AM
Re: Vi question
Since I can created documents 4 to 5 times faster in vi than in MS word, I try type in vi first.
Can you imagine keeping your fingers on the keyboard? Never looking for the mouse? Performing a 2000 mouse click operation with 10 keystrokes? VI: the ugly and extremely useful program.
OH OK....at least it is for me. I've been using it since 1987.