Change previous row field (substr$0,45,4)-1
Change previous row field (substr$0,72,5)+2
Change actual row field (substr$0,40,4)+1
Change actual row field (substr$0,49,1)-1
Change actual row field (substr$0,62,5)+12
Trying to understand your request, I found it doesn't fit the samples:
"Y" indicates "might work"; "N" "doesn't"
Looks like you are overcomplicating things. Why working on characters and substrings? Can't you define it in, say, awk fields? Like if ($7 ~ /2$/) $7+=10, and so on?
---------- Post updated at 22:03 ---------- Previous update was at 20:08 ----------
Please check if the logics deliver what you need; I took into account your input and output samples, not your verbalized request. You can easily adapt that if need be. Formatting according to your input file will take another exercise and is left to you...
That's much easier; don't need a circular buffer but just set a boolean to remember that "2" was found, modify & print the current line, if boolean set then read, modify, & print the next line ans reset the boolean.
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)
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)
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)
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)
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)
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)
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)
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)