I have a file with more than 50,000 lines of records and each record is 50 bytes in length.
I need to search every record in this file between positions 11-19 (9 bytes) and 32-40 (9 bytes) and in case any of the above 2 fields is alpha-numeric, i need to replace the whole 9 bytes of that field by a default numeric value(say, 888888888).
For example, say the input file looks like:
After the search and replace, the output file should look like:
Also, i need to have a log of all the values which I am replacing by using this script.
I tried using awk, sed and perl scripts but could not get the desired output.
Once of the example code I tried using sed but it did not work:
Any help regarding this will be much appreciated. Thanks in advance
Last edited by kikionline; 06-22-2011 at 11:46 PM..
Hello,
Need a little bit of help. Basically I need to replace lines in a file which were calculated wrong as it would 12 hours to regenerate the data. I need to calculate values based on other files which I've managed to figure out with grep/cut but now am stuck on how to shove these new... (21 Replies)
Hi,
I have two files: a.doc and b.txt
I wish to search the strings from file b.txt in a.doc and want to highlight them in a.doc with different colours using Perl or bash./awk/sed?
Please guide me. :)
Thanks!!!!! (10 Replies)
Hi ,
I have one file and in this file i have one like
TEST1 KEY0=AAC040R1;AAC041R1ISE;AAC041R2ISE;AAC370R1;ADR0500;ADR0600;AME245R1;AME245R2;BAP0135;BAP0300;PPINVDTD*;PPJERPTD*;PPJERPT*;PRBSUMM*;:
i want to replace this line with the following line
TEST1... (4 Replies)
Hi,
I have a file with values like this
1 11
2 11
3 44
4 55
5 66 (an representative of what I have).
I want to split this file into smaller files based on column 1 values (values within a range).
The issue that I am facing is that the file is really big, and takes too long to... (21 Replies)
Hi
I search CSV (deliminited by ,) for the string "test" in the second column and if matches print the hole line.
awk -F, '{ if($2=="\"test\"") print $0} ' test.csvHowto to the same in sed? I heared that sed is faster. Test.csv is 121 MB. (1 Reply)
Need help with either sed or awk to acheive the following
file1
-----
In the amazon forest
The bats eat all the time...
mon tue wed they would eat berries
In the tropical forest
The bats eat all the time...
on wed bats eat nuts
In the rain forest
The bats eat all the time...
on... (2 Replies)
I have a file which is
DFDG
START
DSFDS
DSDS
XXX
END (VIO)
AADD
START
SDSD
FGFG
END
and I have to print the lines between START and END (VIO). In the files there are multiple places where START would be followed by END with few lines in between but I need to print only if START is... (18 Replies)
Hi friends,
Could you please help me to resolve the below issue.
Input file :-
<Node>
<username>abc</username>
<password>ABC</password>
<Node>
<Node>
<username>xyz</username>
<password>XYZ</password>
<Node>
<Node>
<username>mnp</username>
... (3 Replies)
Hello,
i have a file like that
foo A new
bar A new
bar B new
I need to replace 'new' with 'done',
but only in lines containing 'bar' AND 'A'.
output file should then become
foo A new
bar A done
bar B new
Sorry im not able to figure it out, not even shure if i should take sed.... (10 Replies)
Here is my problem..
1. I want to search all those files with file name starting AJ128****
(in all the sub directories also)
2. I want to search for the follwoing type of string
line beging with string - 'AK*any_1_char*any_2_char*510'
3. I need to display list of file names... (2 Replies)