09-25-2003
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
:1,10 s/yes/no/g
this ex command will substitute yes with no everytime it is found within the first 10 lines of the file.
:s/yes/no/g
this ex command will substitute yes with no everytime it is found for the line where the cursor is on
my question is how could this substitution be... (4 Replies)
Discussion started by: theDirtiest
4 Replies
2. UNIX for Dummies Questions & Answers
Here is my problem,
I manage a SunOs 5.8 Server, vi is the default command line
editor, I have a line on each users .kshrc profile as follows:
export EDITOR=/bin/vi
I want to use vim as the command line editor, the below line
doesn't work
export EDITOR=/bin/vim
Thank you (1 Reply)
Discussion started by: tony3101
1 Replies
3. UNIX for Dummies Questions & Answers
Hi all,
Here is an example, I would wan to search for all string consists of IMP but not IMP-00015. Values other than 00015 is fine, is there anyone knows how to do that?
Thanks. (2 Replies)
Discussion started by: *Jess*
2 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I knw its a silly question, but am a newbie to 'vi' editor. I'm forced to use this, hence kindly help me with this question.
How can i paste a chunk 'copied from' a different editor(gedit) in 'vi editor'?
As i see, p & P options does work only within 'vi'. (10 Replies)
Discussion started by: harishmitty
10 Replies
5. Shell Programming and Scripting
Hi All,
I am running a script , working very fine on cmd prompt. The problem is that when I open do crontab -e even after setting editor to vi by
set EDITOR=vi it does not open a vi editor , rather it do as below.....
/////////////////////////////////////////////////////
$ set... (6 Replies)
Discussion started by: aarora_98
6 Replies
6. Shell Programming and Scripting
I've this command in a script which edits the file ...
bash$ cat temp_file.txt
THREAD #2 2 Running
bash$ (echo "s/THREAD #2/d"; echo 'wq') | ex -s temp_file.txt
bash$ cat temp_file.txt
THREAD #2 2 Running
If i've more than 1 line it easily deletes the line, but if it is the last line... (3 Replies)
Discussion started by: prash184u
3 Replies
7. UNIX for Dummies Questions & Answers
Hi Folks
I have opened a log file in Vi editor
vi abc.logPlease advise me how to finally quit from Vi editor, which command is there..!
Is it :q<Enter> (1 Reply)
Discussion started by: KAREENA18
1 Replies
8. Shell Programming and Scripting
Dear all,
i am having text file like below
surya
rama
ranga
laxman
rajesh
reddy
i want add string (OK) before a text from line 3 to 5
the result will be
surya
rama
OK ranga
OK laxman
OK rajesh
reddy (1 Reply)
Discussion started by: suryanarayana
1 Replies
9. UNIX for Beginners Questions & Answers
Hi Guru's,
I'm new at Unix. I am tasked to monitor the filesystem utilization on OS level (Unix) and DB (Sybase) for multiple systems. I am thinking to use vi editor and make a file, execute that file and all the file systems I need to monitor will be be shown.
My script inside vi goes in... (8 Replies)
Discussion started by: Xworks
8 Replies
10. Shell Programming and Scripting
Hi, I need help.
I need to build command for line command editor vi. I want to take the whole string and assemble it in a regular expression. He then folded into another shape.
Can anyone help me? (4 Replies)
Discussion started by: Pabloss
4 Replies
LEARN ABOUT CENTOS
file::inplace
File::Inplace(3) User Contributed Perl Documentation File::Inplace(3)
NAME
File::Inplace - Perl module for in-place editing of files
SYNOPSIS
use File::Inplace;
my $editor = new File::Inplace(file => "file.txt");
while (my ($line) = $editor->next_line) {
$editor->replace_line(reverse $line);
}
$editor->commit;
DESCRIPTION
File::Inplace is a perl module intended to ease the common task of editing a file in-place. Inspired by variations of perl's -i option,
this module is intended for somewhat more structured and reusable editing than command line perl typically allows. File::Inplace endeavors
to guarantee file integrity; that is, either all of the changes made will be saved to the file, or none will. It also offers functionality
such as backup creation, automatic field splitting per-line, automatic chomping/unchomping, and aborting edits partially through without
affecting the original file.
CONSTRUCTOR
File::Inplace offers one constructor that accepts a number of parameters, one of which is required.
File::Inplace->new(file => "filename", ...)
file
The one required parameter. This is the name of the file to edit.
suffix
The suffix for backup files. If not specified, no backups are made.
chomp
If set to zero, then automatic chomping will not be performed. Newlines (actually, the contents of $/) will remain in strings
returned from "next_line". Additionally, the contents of $/ will not be appended when replacing lines.
regex
If specified, then each line will be split by this parameter when using "next_line_split" method. If unspecified, then this
defaults to s+.
separator
The default character used to join each line when replace_line is invoked with a list instead of a single value. Defaults to a
single space.
INSTANCE METHODS
$editor->next_line ()
In scalar context, it returns the next line of the input file, or undef if there is no line. In an array context, it returns a single
value of the line, or an empty list if there is no line.
$editor->replace_line (value)
Replaces the current line in the output file with the specified value. If passed a list, then each valie is joined by the "separator"
specified at construction time.
$editor->next_line_split ()
Line "next_line", except splits based on the "regex" specified in the constructor.
$editor->has_lines ()
Returns true if the file contains any further lines.
$editor->all_lines ()
Returns an array of all lines in the file being edited.
$editor->replace_all_lines (@lines)
Replaces all remaining lines in the file with the specified @lines.
$editor->commit ()
Completes the edit operation and saves the changes to the edited file.
$editor->rollback ()
Aborts the edit process.
$editor->commit_to_backup ()
Saves edits to the backup file instead of the original file.
AUTHOR
Chip Turner, <chipt@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005 by Chip Turner
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.0 or,
at your option, any later version of Perl 5 you may have available.
POD ERRORS
Hey! The above document had some coding errors, which are explained below:
Around line 283:
You forgot a '=back' before '=head1'
Around line 285:
'=item' outside of any '=over'
perl v5.16.3 2005-01-29 File::Inplace(3)