- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Manipulations with files
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-09-2009 10:04 PM
11-09-2009 10:04 PM
I would like to find out some trip of manipulations with files. Manipulations with files. Sometimes i run vi
I also use ctrl+i for edit, dd- for delete, p -for cancel, a for staying in end of line.
For now, i have to close my file without savings.After that have to add some strings. How should i do?
Regards,
Rustam.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2009 10:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2009 10:12 PM
11-09-2009 10:12 PM
Re: Manipulations with files
Another small attachment for vi tips.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2009 11:56 PM
11-09-2009 11:56 PM
Re: Manipulations with files
This is good, just try to these command in a test file and you would have some idea about it.
BR,
Kapil+
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2009 03:46 AM
11-10-2009 03:46 AM
Re: Manipulations with files
:q! says delete all changes.
If you want to keep them: :wq
Or just ZZ.
You can use view vs vi if you don't intend to make changes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2009 03:52 AM
11-10-2009 03:52 AM
Re: Manipulations with files
i think this is a very goof docu directly from HP :
http://www.hp.com/education/courses/vi.pdf
mikap
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2009 10:09 PM
11-10-2009 10:09 PM
Re: Manipulations with files
I have some question, i didnt get some issues.
1. I'd prefer command mode , i liked it. Sometimes i need to type Esc for running command( which has 1/2 character long). Why? Maybe i do something wrong? For instance: i typed 'yy'->'p' then 'd', after that i would liked to leave without saving :q!. But i didn't be in VI's command mode. why commands don't run step by step, i mean sometimes i have to remind to VI and type Esc?
2. I didn't get, what's EX Editor.
3. Have i to configure :set 'Settings for VI'
4. Now i know what is Abbreviations and how to use, but still don't know 'Mapping Keys to Other Keys'.
5. Should i configure - 'The EXINIT Environment Variable and the .exrc file'
6. About recovering. For instance, if while i editing file, server got some problem or connection was lost. In this case i must recovery file? vi -r those_file
Hi Kapil+, i couldnt open article which you offered me. Could you send me again or that's file.
Regards,
Rustam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2009 07:08 AM
11-11-2009 07:08 AM
Re: Manipulations with files
I'm not sure what you mean by the above....
".... Sometimes i need to type Esc for running command( which has 1/2 character long). Why? Maybe i do something wrong? For instance: i typed 'yy'->'p' then 'd', after that i would liked to leave without saving :q!. But i didn't be in VI's command mode. why commands don't run step by step, i mean sometimes i have to remind to VI and type Esc?
The esc is required to switch from input/change mode to the command "prompt". it is what it is, and from your description, it appears to be working normally.
"2. I didn't get, what's EX Editor."
"vi" is the "visual" editor. ex is the line editor, and vi sort of builds on top of it. the closest analogy i can come up with is that ex is to vi as wordstar (dot commands) is to word???
"3. Have i to configure :set 'Settings for VI'"
there are a lot of variables that can be set in vi to change behaviour and presentation of the file / input. settings are optional...
"4. Now i know what is Abbreviations and how to use, but still don't know 'Mapping Keys to Other Keys'."
???
"5. Should i configure - 'The EXINIT Environment Variable and the .exrc file'"
same as 3 above
"6. About recovering. For instance, if while i editing file, server got some problem or connection was lost. In this case i must recovery file? vi -r those_file"
that should be self explanatory...but the answer is "probably". I've not had an issue where I needed the recovery file in a long time, but as I recall, if you attempt to edit the original file it will tell you the recovery file exists...and what option to use.
======================================================================================
note that Kapil's link worked without issue for me, so you might try "cut-and-pasting" the link into your browser.
Also, you really need to read, and understand, the docs, as this isn't really a teaching forum, so much as a troubleshooting forum.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2009 04:36 AM
11-12-2009 04:36 AM
Re: Manipulations with files
first, sorry for my english. English is not native language, and in our country ppl rarely use english. I'm learning by reading english books, i know my english is still awful.
1. i got. I was wrong.
2,3,4 - i solved after reading docs.
5 and 6. thanks, i got.
yeah, i checked Kapil+ 's link, works.Thanks.
By the way, i use FAR for Windows machines. Could i install and run FAR or mc on HP-UX?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2009 05:43 AM
11-12-2009 05:43 AM
Re: Manipulations with files
man vi
man ex
Note that Amazon.com sells the book new for almost $60 USD but there are a *lot* of used copies for less than $10 USD: http://www.amazon.com/gp/offer-listing/0805344608/ref=dp_olp_used?ie=UTF8&condition=used
> By the way, i use FAR for Windows machines. Could i install and run FAR or mc on HP-UX?
It appears that FAR is PC-only. http://www.helpware.net/FAR/. If "mc" means Midnight Commander, then PCs and Linux. Source code is available for GNU MC: http://www.midnight-commander.org/ but you'll need a compiler and some development skills.
HP-UX is not PC Windows and while you can hide some of the details with add-on programs, it is best to learn each new operating system and the built-in tools. vi is standard on every Unix system and there's not much you can do without vi.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2009 08:10 PM
11-15-2009 08:10 PM
Re: Manipulations with files
First, yeah, i know the best way is to read a book.But i can't order through amazon. i can afford 1,2 or 3..$.it's not much but issues is to order from Europe or US. I'm not from Europe or America, our country is too small and impossible to order things like this. We have book-shops, but there are not any books in english moreover HP-UX which is specific OS.
ok,i'm quite agree.i like learn new things, so ready to use vi without mc.I try to do my best.
Regards,
Rustam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2009 05:47 AM
11-16-2009 05:47 AM
Re: Manipulations with files
http://docstore.mik.ua/orelly/unix/vi/
This is the O'Reilly book online. It is a fairly typical textbook and best used by reading a chapter at a time, then practicing on test files.
http://www.gentoo.org/doc/en/vi-guide.xml
This document is great as it is a cheatsheet, or a document with the most useful commands (in vi, a command is a single character). I especially like the handwritten notes which start small and then add on more commands as you learn more.
http://thomer.com/vi/vi.html
This is the vi lovers page. Not so much of a learning guide as it is a collection of vi references. Note that it does have a lot of comments about vim (which is: VI iMproved). However, vim is not standard with most Unix installs and must be downloaded and installed.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2009 06:04 AM
11-16-2009 06:04 AM
Re: Manipulations with files
You can download a vi editor here:
http://portablegvim.sourceforge.net/downloads.html
Good thing is....IT IS INSTALLED ON WINDOWS ....so you can practice it endlessly without using any server.
Hands-on is always better.
Regds..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2009 10:46 PM
11-22-2009 10:46 PM
Re: Manipulations with files
R.K. #.
Last week i installed GVimPortable on my pc and by reading articles and e-books which you gave me, have done a lot of practices.
Now i know such as commands:
movement, open, save+quite, windowing,insert mode, edit commands, compound, cut and paste, search.
I think for it's enough for now, coz i must start to learn OS HP-UX's commands as vi command, if i knew HP-UX's basic command as i know vi's command it would be fine.
I didn't get 2 things, could you explain them?
1. I checked my vi's :set options, there are a lot options. Did these parameters made after installing OS or they are default ones? I mean this, coz OS were installed by HPâ s specialist and i don't know did he configure vi or vi has default parameters now. Maybe in the future, I will need to reinstall OS, I'm curious after reinstalling should I install vi and configure or I will get such I have now. Should I change VI to VIM or shouldn't yet?
2. Maybe because of English is not my native language I cant get purpose of autoindentation. How and what should I use for?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 01:35 AM
11-23-2009 01:35 AM
Re: Manipulations with files
>>I checked my vi's :set options, there are a lot options. Did these parameters made after installing OS or they are default ones?
These options are inbuilt. I think vi would serve whatever you require. So there should not be any need to go for vim
>>I cant get purpose of autoindentation.
Using auto-indent
For writing code in various programming languages, indentation is an important part of style. vi can be set up for automatic indenting. If auto-indent is enabled and vi is in insert mode, then when you start a new line it has the same amount of indentation as the previous line. If you want to use auto-indent you need to get into command mode (hit the escape key) and
* enable auto-indent with :set ai sw=4
See below link fo rmore info:
http://www.d.umn.edu/~gshute/vi/vi.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2009 05:52 AM
11-23-2009 05:52 AM
Re: Manipulations with files
As mentioned before, vi has many parameters that are preset and without a file $HOME/.exrc, then the :set command shows you these settings. There are two ways to set the options to different values:
1. use the :set command as in :set ignorecase
or
2. create a .exrc file in your $HOME directory. There is an example .exrc file in /usr/newconfig/etc/skel/.exrc but for the options, only the first line starting with set is useful. The rest of the lines are specific to HP terminals and emulators.
A good starting .exrc file would be:
set noautoindent nowrapscan autowrite ignorecase wrapmargin=0
The word: 'no' in front of an option turns off the feature. wrapscan is very useful because vi searches (the / or the ?) will wrap around bottom to top without warning. Setting wrapscan will stop the search at the end of the file. autowrite will write the current changes to the file if you run an external command. ignorecase means that vi will search for UPPER and lower case characters equally (ABC=abc=aBc) and wrapmargin will automatically add a newline if you reach the right margin. Note that wm=70 does not mean wrap at column 70 -- it means wrap at 70 characters to the left of the end of the line. wrapmargin=10 will insert a new line when you reach 10 characters before the right margin.
Note that most of the set options can be abbreviated like this:
set noai nows aw ic wm=0
Here is one of many quick references to vi commands and set options:
http://people.cis.ksu.edu/~bhoward/vi/vi60.html
> Should I change VI to VIM or shouldn't yet?
I would not use vim because it won't be found on many systems and if you get familiar with all the vim features that are not in vi, you'll have difficulties on those other systems.
> purpose of autoindentation. How and what should I use for?
AS mentioned above, indentation is part of good programming style. It shows sections of code that belong together. You would type extra spaces at the beginning of each line to line up the code. After a while, typing all those spaces in front of many lines becomes tedious. So autoindent (automatic indentation) inserts the additional spaces automatically. Here is an example of indentation:
line1
line2
line3
line4
line5
line6
line7
To move back to the beginning of a new line, use the command: CTRL-D (the control key plus the letter d). CTRL-D will backspace one tab space to the left. Press it several times and you'll be back to column where you can start typing.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2009 07:36 PM
11-25-2009 07:36 PM
Re: Manipulations with files
Regards,
Rustam.