I have an input like following.
I want to modify the 3rd line after *DEFINE_CURVE_TITLE like
3 0 1.000000 107.00000 0.000 0.000 0
so that it becomes
The question is that I can search for the required line as follows
This way I am on the line to be edit i.e. three lines below the search string.
Now I have to change the values of $4 from 125.00000 to someother value that could be taken from newBHF.txt. That newBHF.txt has the required replacement i.e only one value 107.00000 . If possible please also tell me how can I set $4 , if I have the value in another variable in the same program.
This will help to do alot of things myself.
best regards
Moderator's Comments:
Please use next time code tags for your code and data
I am sorry that was a typo , i.e it should be 1.00000 .
so in that case , I need to replace field 4.
thanks.
---------- Post updated at 03:03 AM ---------- Previous update was at 02:58 AM ----------
worked perfect. thanks man.
---------- Post updated at 03:13 AM ---------- Previous update was at 03:03 AM ----------
the problem is that , it has changed the format, I mean the software only recognize the changed file when it is in the same format, so please help me also to keep the format, like number of spaces on left and also in between .
original
changed
Quote:
3 0 1.000000 107.00000 0.000 0.000 0
regards.
Last edited by hamnsan; 03-01-2012 at 04:27 AM..
Reason: to show the change in format upon replacement of required field.
Hi all,
Let's say I have a script calling for the two variables PA_VALUE and PB_VALUE.
for pa in PA_VALUE
blah blah
do
for pb in PB_VALUE
blah blah
do
I have a text file with two columns of values for PA and PB.
14.5 16.7
7.8 9.5
5.6 3.6
etc etc
I would like to read this... (7 Replies)
Sed command to replace a line in a file using line number from the output of a pipe.
Is it possible to replace a whole line piped from someother command into a file at paritcular line...
here is some basic execution flow..
the line number is 412
lineNo=412
Now i have a line... (1 Reply)
All, I appreciate any help you can offer here as this is well beyond my grasp of awk/sed...
I have an input file similar to:
&LOG
&LOG Part: "@DB/TC10000021855/--F"
&LOG
&LOG
&LOG Part: "@DB/TC10000021852/--F"
&LOG Cloning_Action: RETAIN
&LOG Part: "@DB/TCCP000010713/--A"
&LOG
&LOG... (5 Replies)
my requirement is,
consider a file output
cat output
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
this doesnt look good
et cetc etc
etcetera
i want to replace a line of line number 4 ("this doesnt look good") with some other line
... (3 Replies)
Hi How Are you?
I am doing fine!
I need to go now?
I will see you tomorrow!
Basically I need to replace the entire line containing "doing" with a blank line:
I need to the following output:
Hi How Are you?
I need to go now?
I will see you tomorrow!
Thanks in advance.... (1 Reply)
Hi experts,
In my text file I have the following alot of lines like below.
input.k is as follows.
2684717 -194.7050476 64.2345581 150.6500092 0 0
2684718 -213.1575623 62.7032242 150.6500092 0 0
*INCLUDE
$# filename... (3 Replies)
hi experts ,
I have an input like following.
R sfst 1000.0000
$ new time step for mass scaled calculation
R dt2ms -4.000E-7
$ friction value for blank
R mue ... (10 Replies)
QUESTION 1:
How do you replace a specific line (i.e. line 4) with a new user defined line (i.e. the contents of SAMS’s name, history, math and English grades have been set already). I have been attempting to use SED (FYI: I don’t have GNU SED) or AWK, but haven’t had any luck. FYI: I am using... (1 Reply)
I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work.
Brief overview:
I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Hello
I have a document and in this document I have several occurrence of "VAR == xxxxxxx" and xxxxx can be anything. I don't know what it is. I want to replace the 'xxxxx's with something I know.
What I know however, is the line numbers of the VAR =='s in the file.
How can I replace... (1 Reply)