Sponsored Content
Full Discussion: Replace values
Top Forums Shell Programming and Scripting Replace values Post 302936012 by jiam912 on Saturday 21st of February 2015 03:51:13 PM
Old 02-21-2015
Dear RudiC

Sorry to ask you again.

What i should change in the code to be able to make the changes
In the next line when the value 2 is found, and not the previous line like It is now.

I have try many things, but i cant

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace the column values.

I have the below file ...where some of the column values should replaced with desired values ....below file u can find that 3 column where ever 'AAA' comes should replaced with ' CC ' NOTE : we have to pass the column number ,AAA,CC (modified value) as the parameters to the code. ... (6 Replies)
Discussion started by: charandevu
6 Replies

2. Web Development

Replace xml values

Hallo all, I try to create a bash script but till now without any positiv results. The script should replace different variables in a text file with the right xml values Look at the following xml file: file.xml =================================== <?xml version="1.0"... (1 Reply)
Discussion started by: research3
1 Replies

3. UNIX for Dummies Questions & Answers

using sed to replace values...

I have a file: $somevar=somevalue $anothervar= $someothervar=45 I'd like to be able to replace the values in the file. I just don't know how exactly to use sed. I was thinking along the lines of: cat file | sed "s/$somevar=/anotherval/g" I was hoping this would make the... (2 Replies)
Discussion started by: mrwatkin
2 Replies

4. Shell Programming and Scripting

Find and replace many values

Dear Friends, I did the same question before in other thread, but I want to explain a little better my request. I am looking for a way how to find and replace a values in two files using a reference a file where are the key to replace. Basically, I want to keep a copy of the original file... (1 Reply)
Discussion started by: jiam912
1 Replies

5. Shell Programming and Scripting

Replace values between 2 files

I want to replace the third and fourth lines of a 2nd file by the first two lines of a file. Input: file_1 file_1.line_1 file_1.line_2 file_2 file_2.line_1 <file_2.line_2_blank> file_2.line_3 file2.line_4 <file_2.line_5_blank> Output: file_2.line1 <file_2.line_2_blank>... (1 Reply)
Discussion started by: arpagon
1 Replies

6. Shell Programming and Scripting

Replace values in columns

I have the following input format: AA00000712000 -0.17 0.90 -1.04 -0.37 -1.45 -1.13 -0.22 -0.34 -0.55 2.37 0.67 -0.48 -0.48 AA00000712001 0.15 0.03 0.47 0.62 2.04 1.14 0.29 -0.81 0.85 0.53 1.00 -0.10 -0.48 BB00000712000 1.32 -0.47 0.44 0.00 0.98 ... (4 Replies)
Discussion started by: ncwxpanther
4 Replies

7. Shell Programming and Scripting

Replace values

Gents, Can you please help with this. Input file 49955 2009 2 49957 2010 2 49959 2010 2 49961 2010 2 49963 2010 2 49789 2011 -174 49791 2011 2 49793 2011 2 49795 2011 2 49965 2011 170 49967 2011 2 49969 2011 2 49971 2011 2 49797 2012 -174 49799 2012 2 (8 Replies)
Discussion started by: jiam912
8 Replies

8. Shell Programming and Scripting

Replace values using other file

Gents, Please can you help me. I need to update file1 using file2 values file1 S 44519.00 49349.00 1V1 0.0 0 0.0 0.0 0.0 0.0289091513 S 44513.00 48581.00 1V1 0.0 0 0.0 0.0 0.0 0.0289094319 S 44511.00 48605.00 1V1 0.0 0 0.0... (1 Reply)
Discussion started by: jiam912
1 Replies

9. Shell Programming and Scripting

To transpose and replace the values

Hi Guys, I am having a file like below AZ_H,NZ_K,IN_F,AZ1_A output required AZ_H string, NZ_K int, IN_F int, AZ1_A double the values will starting like below _A - double _F - int _H - string _K - int (6 Replies)
Discussion started by: rohit_shinez
6 Replies

10. Shell Programming and Scripting

Replace values on file

Gents, Please i need your help. Using the file2.txt i will like to replace values in file3.txt. Example in file 2 column 1 is the value to find in file3.txt and replace with value in colunm2 (file2.txt). Example file2.txt 21 1209 22 1210file3.txt SCI TB Timestamp Local : 8/30/17... (2 Replies)
Discussion started by: jiam912
2 Replies
DATAFLOW(1p)						User Contributed Perl Documentation					      DATAFLOW(1p)

NAME
PDL::Dataflow -- description of the dataflow philosophy SYNOPSIS
pdl> $a = zeroes(10); pdl> $b = $a->slice("2:4:2"); pdl> $b ++; pdl> print $a; [0 0 1 0 1 0 0 0 0 0] WARNING
Dataflow is very experimental. Many features of it are disabled for 2.0, particularly families for one-directional dataflow. If you wish to use one-directional dataflow for something, please contact the author first and we'll work out how to make it functional again. Two-directional dataflow (which implements ->slice() etc.) is fully functional, however. Just about any function which returns some subset of the values in some piddle will make a binding so that $a = some piddle $b = $a->slice("some parts"); $b->set(3,3,10); also changes the corresponding element in $a. $b has become effectively a window to some sub-elements of $a. You can also define your own routines that do different types of subsets. If you don't want $b to be a window to $a, you must do $b = $a->slice("some parts")->copy; The copying turns off all dataflow between the two piddles. The difficulties with one-directional dataflow are related to sequences like $b = $a + 1; $b ++; where there are several possible outcomes and the semantics get a little murky. DESCRIPTION
Dataflow is new to PDL2.0. The basic philosophy behind dataflow is that > $a = pdl 2,3,4; > $b = $a * 2; > print $b [2 3 4] > $a->set(0,5); > print $b; [10 3 4] should work. It doesn't. It was considered that doing this might be too confusing for novices and occasional users of the language. Therefore, you need to explicitly turn on dataflow, so > $a = pdl 2,3,4; > $a->doflow(); > $b = $a * 2; ... produces the unexpected result. The rest of this documents explains various features and details of the dataflow implementation. Lazy evaluation When you calculate something like the above > $a = pdl 2,3,4; > $a->doflow(); > $b = $a * 2; nothing will have been calculated at this point. Even the memory for the contents of $b has not been allocated. Only the command > print $b will actually cause $b to be calculated. This is important to bear in mind when doing performance measurements and benchmarks as well as when tracking errors. There is an explanation for this behaviour: it may save cycles but more importantly, imagine the following: > $a = pdl 2,3,4; > $b = pdl 5,6,7; > $c = $a + $b; ... > $a->resize(4); > $b->resize(4); > print $c; Now, if $c were evaluated between the two resizes, an error condition of incompatible sizes would occur. What happens in the current version is that resizing $a raises a flag in $c: "PDL_PARENTDIMSCHANGED" and $b just raises the same flag again. When $c is next evaluated, the flags are checked and it is found that a recalculation is needed. Of course, lazy evaluation can sometimes make debugging more painful because errors may occur somewhere where you'd not expect them. A better stack trace for errors is in the works for PDL, probably so that you can toggle a switch $PDL::traceevals and get a good trace of where the error actually was. Families This is one of the more intricate concepts of one-directional dataflow. Consider the following code ($a and $b are pdls that have dataflow enabled): $c = $a + $b; $e = $c + 1; $d = $c->diagonal(); $d ++; $f = $c + 1; What should $e and $f contain now? What about when $a is changed and a recalculation is triggered. In order to make dataflow work like you'd expect, a rather strange concept must be introduced: families. Let us make a diagram: a b / c /| / | e d This is what PDL actually has in memory after the first three lines. When $d is changed, we want $c to change but we don't want $e to change because it already is on the graph. It may not be clear now why you don't want it to change but if there were 40 lines of code between the 2nd and 4th lines, you would. So we need to make a copy of $c and $d: a b / c' . . . c /| | / | | e d' . . . d f Notice that we primed the original c and d, because they do not correspond to the objects in $c and $d any more. Also, notice the dotted lines between the two objects: when $a is changed and this diagram is re-evaluated, $c really does get the value of c' with the diagonal incremented. To generalize on the above, whenever a piddle is mutated i.e. when its actual *value* is forcibly changed (not just the reference: $d = $d + 1 would produce a completely different result ($c and $d would not be bound any more whereas $d .= $d + 1 would yield the same as $d++), a "family" consisting of all other piddles joined to the mutated piddle by a two-way transformation is created and all those are copied. All slices or transformations that simply select a subset of the original pdl are two-way. Matrix inverse should be. No arithmetic operators are. Sources What you were told in the previous section is not quite true: the behaviour described is not *always* what you want. Sometimes you would probably like to have a data "source": $a = pdl 2,3,4; $b = pdl 5,6,7; $c = $a + $b; line($c); Now, if you know that $a is going to change and that you want its children to change with it, you can declare it into a data source (XXX unimplemented in current version): $a->datasource(1); After this, $a++ or $a .= something will not create a new family but will alter $a and cut its relation with its previous parents. All its children will follow its current value. So if $c in the previous section had been declared as a source, $e and $f would remain equal. Binding A dataflow mechanism would not be very useful without the ability to bind events onto changed data. Therefore, we provide such a mechanism: > $a = pdl 2,3,4 > $b = $a + 1; > $c = $b * 2; > $c->bind( sub { print "A now: $a, C now: $c " } ) > PDL::dowhenidle(); A now: [2,3,4], C now: [6 8 10] > $a->set(0,1); > $a->set(1,1); > PDL::dowhenidle(); A now: [1,1,4], C now: [4 4 10] Notice how the callbacks only get called during PDL::dowhenidle. An easy way to interface this to Perl event loop mechanisms (such as Tk) is being planned. There are many kinds of uses for this feature: self-updating graphs, for instance. Blah blah blah XXX more explanation Limitations Dataflow as such is a fairly limited addition on top of Perl. To get a more refined addition, the internals of Perl need to be hacked a little. A true implementation would enable flow of everything, including data data size datatype operations At the moment we only have the first two (hey, 50% in a couple of months is not bad ;) but even this is useful by itself. However, especially the last one is desirable since it would add the possibility of flowing closures from place to place and would make many things more flexible. To get the rest working, the internals of dataflow probably need to be changed to be a more general framework. Additionally, it would be nice to be able to flow data in time, lucid-like (so you could easily define all kinds of signal processing things). AUTHOR
Copyright(C) 1997 Tuomas J. Lukka (lukka@fas.harvard.edu). Redistribution in the same form is allowed provided that the copyright notice stays intact but reprinting requires a permission from the author. perl v5.14.2 2012-01-02 DATAFLOW(1p)
All times are GMT -4. The time now is 10:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy