02-28-2006
Hi Vino,
This is wonderful use of sed. I have another query on the same situation, What if i need to append or insert a few more lines BEFORE a particualr string.
How can i do that?
Cheers !!!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
when i am running a sed command i want to get rid of all of the backslashes in the lin but it is taking this as being a command how do i delete backslashes?????
sed -e "s/\/g"
Anyn ideas????????? (7 Replies)
Discussion started by: johnnynolegs
7 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I'm trying to use the sed command but I'm not sure how to use it properly. I've read the man pages for the sed command but I'm still unsure on how to use it.
Basically I have a file with the words male and female written multiple times. I want to swap the word male for female and... (4 Replies)
Discussion started by: tugade
4 Replies
3. Shell Programming and Scripting
At the moment, I'm trying to do the following:
1. Have sed read the first line of a file
Example (file1.x):
5
2. Replace that first line with a new first line, which would read
5=newvariable
3. Have that information placed into file2.y
Unfortunately, I'm having a problem. Sed... (5 Replies)
Discussion started by: Agent-X
5 Replies
4. Solaris
Hi,
The config file:
# Port(s) for accepting client connections
RTSPPort=554
bash-3.00# awk -F"=" -v gr="888" '/RTSPPort/{$2=gr;}1' OFS="=" server.ini
awk: syntax error near line 1
awk: bailing out near line 1
Can you help me on why this doesn't work.
The next one neighter. Dosn't... (0 Replies)
Discussion started by: potro
0 Replies
5. Shell Programming and Scripting
i have a file acc.sh which has about 10 lines and then i have defined $var which has a line number in it (say 5). i want to extarct from line 5 to the end of the file and put the output into another file. I have used
sed -n $var,'$p' acc.sh | tee abc.sh
but at times it does'nt work and gives an... (6 Replies)
Discussion started by: lassimanji
6 Replies
6. Shell Programming and Scripting
Hi everyone!
I have a file like that:
And I would it like that:
I don't know how to keep the first field and sort the second one.
I have a second question with sed...
to put the variable $VAR at the beginning of the file...
But I have an output like this:
snork... (3 Replies)
Discussion started by: Castelior
3 Replies
7. UNIX for Advanced & Expert Users
$ echo "a,0,0,0,b,0" | sed 's/,0,/,1,/g'
gives output as
$ a,1,0,1,b,0
rather than as
a,1,1,1,b,0
how can i solve this problem
Thanks a lot in advance....
Use code tags. (4 Replies)
Discussion started by: manishma71
4 Replies
8. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Okay so I am taking bash scripting this semester and we are now working on the stream editor sed. For our book we... (4 Replies)
Discussion started by: aggie6970
4 Replies
9. Shell Programming and Scripting
Hi,I confused how to use sed to deal with big file.
example:
the big file have some different urls just with filename.
how can i use sed to fetch url except file name and replace to other urls with filename?
thanks!!! (11 Replies)
Discussion started by: hshzh359
11 Replies
10. HP-UX
Hello,
I have spent a couple of hours trying to answer this myself, so forgive me if the answer is simple but I have tried.
I have a text file generated from svn log output which contains a list of files.
Two regexps im using are
*
and
*
They both work but some lines has a mixture... (7 Replies)
Discussion started by: YogaBija
7 Replies
LEARN ABOUT DEBIAN
statistics::basic::_twovectorbase
Statistics::Basic::_TwoVectorBase(3pm) User Contributed Perl Documentation Statistics::Basic::_TwoVectorBase(3pm)
NAME
Statistics::Basic::_TwoVectorBase - base class objects like Correlation
METHODS
query()
Query the value of the object. It will return the undefined value until there's something to calculate.
insert()
Insert two new new values into the vectors. This function must be given precisely two arguments and probably shouldn't be undefined
values in most cases.
# insert a 4 in one vector and a 3 in the other
$object_instance->insert( 4, 3 );
append() ginsert()
The growing insert inserts new elements, growing the max size of the vector to accommodate the new elements (if necessary). This
function must be given precisely two arguments and probably shouldn't be undefined values in most cases.
# append a 4 in one vector and a 3 in the other
$object_instance->ginsert( 4, 3 );
query_size()
The current size of the vectors -- regardless of their max size (as set by "set_size()"). This function returns a list, i.e.:
my @s = $obj->query_size; # two values
my $s = $obj->query_size; # the right hand value of the list
set_size()
Set the maximum size for the underlying Statistics::Basic::Vector objects. This function requires two arguments.
set_vector()
Set the vector objects used to calculate the object's value. This function takes two arguments -- which can either be arrayrefs or
Statistics::Basic::Vector objects. They must have the same number of elements.
my $v1 = vector
my $v2 = $v1->copy;
$example_correlation->set_vector($v1, $v2);
OVERLOADS
This class provides overloads. If evaluated as a string, it will attempt to print a pretty value for the object (or "n/a", see "query()"
above). the resulting string can be tuned, in terms of precision, see ipres for further information.
If evaluated as a number, it will try to return the raw result of "query()", possibly turning the resulting "undef" (if applicable) into a
0 in the process -- note that Perl does this 0-izing, not the overload.
The "eq" and "==" operators are also overloaded, trying to do the right thing. Also see toler for further information.
AUTHOR
Paul Miller "<jettero@cpan.org>"
COPYRIGHT
Copyright 2012 Paul Miller -- Licensed under the LGPL
SEE ALSO
perl(1), Statistics::Basic, Statistics::Basic::Vector
perl v5.14.2 2012-01-23 Statistics::Basic::_TwoVectorBase(3pm)