![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| set EDITOR=vi -> default editor not setting for cron tab | aarora_98 | Shell Programming and Scripting | 6 | 3 Weeks Ago 11:01 PM |
| regarding vi editor | girish_shukla | SCO | 3 | 02-19-2008 03:58 AM |
| Vi editor | jazz | High Level Programming | 1 | 11-17-2005 04:37 AM |
| vi editor | eloquent99 | UNIX for Dummies Questions & Answers | 1 | 01-14-2003 01:49 AM |
| Using the vi editor | pbsys | UNIX for Dummies Questions & Answers | 2 | 11-05-2001 11:27 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
| Forum Sponsor | ||
|
|
|
||||
|
The main problem i'm having with vi is, that i understand how to open a file on specific line, the thing I don't get is how to save the changes. For example, I've been trying to do something like this.
Code:
vi +5n myfile :i "Insert some text" :w :q It's probably silly me I've tried to use sed, and it helped, although that was the code I've found on Internet, but I don't understand completely the meaning of criterias yet. p.s. I've managed to solve the given example using temp file, which is being an absolutely time and space consuming solution.... |
|
|||
|
You can simply do whatever you want with test in ed/sed/awk etc.
Notice that, you can edit content of file during reading it and forward output from it to other file and after that simple overwrite it e.g. in awk: Code:
awk 'some_code' some_file > new_file; mv new_file some_file Code:
ed file <<-ENDIT g/nrumber_of_line/a/some_new_text/ w q ENDIT |