Ignore some lines with specific words from file comparison
Hi all,
I need help in doing this scenario. I have two files with multiple lines. I want to compare these two files but ignoring the lines which have words like Tran, Loc, Addr, Charge. Also if i have a word Credit in line, i want to tokenize (i.e string after character "[" ) that line and compare a substring of it.
File looks like
Record 1
Tran@1050e1f[
airbillNbr=1324576
origLocInfo=Loc@1c29ab2[
locId=923
state=FL
locCntry=US
postal=32817
locNbr=456
locCurr=CAD
lglEntity=E
]
destLocInfo=Loc@337838[
locId=298
state=FL
locCntry=US
postal=32845
locNbr=456
locCurr=CAD
lglEntity=E
]
shpDt=Tue Jan 08 00:00:00 EST 2008
shprAddrInfo=Addr@18558d2[
acctNbr=123456789
name=Peyton Manning
company=Giants
address1=Sports Nation
address2=
city=New York
state=NY
country=US
postal=76543
]
Charge@19c26f5[
code=305
crdtCard=Credit@15eb0a[creditCardTypeCode=M,creditCardExpDate=Sat Feb 28 00:00:00 EST 2009]
You could use the 'grep -v word ' or 'nawk '$0 !~ /word/' to filter files, redirect output into another files, and after complete filtering, compare files.
That is for word Tran and file fl1 you would use comands:
grep -v Tran fl1 > fltr_fl
or
nawk '$0 !~ /Tran/' fl1 > fltr_fl
For "tokenize" I would use the nawk -F[ ' {if ($0 ~ "Credit") { sub($1,"",$0);} print }' fl1 (should be remuwed else first '[' after that, maybe someone else will help on that)
I would put filtering commands in script and on end of that run the diff on filtered files.
Also the filtering the lines with worlds I would do in : for wrd in ...all words...; do .. done
So, it would be this way:
How do you write a script to ignore all lines except the --- dash lines and then remove --- dashes from the data in a text file?
Also how do you separate data in a text file with a tab (for example, column1 (software) and column2 (date) ) ?
Here is my scripts : I am getting errors in... (3 Replies)
Hi,
Please have a look on below records.
STG_HCM_STATE_DIS_TAX_TBL.1207.Xfm: The value of the row is: EMPLID = 220677 COMPANY = 919 BALANCE_ID = 0 BALANCE_YEAR = 2012
STG_HCM_STATE_DIS_TAX_TBL.1207.Xfm: ORA-00001: unique constraint (SYSADM.PS_TAX_BALANCE) violated
... (4 Replies)
Dear all,
Greetings.
I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed.
For example, the input file is:
1 ak1 abc1.0
1 ak2 abc1.0
1 ak3 abc1.0
1 ak4 abc1.0
1 ak5 abc1.1
1 ak6 abc1.1
1 ak7... (7 Replies)
I have a file proc.txt:
if @debug = 1 then
message 'Start Processing ', @procname, dateformat(now(*), 'hh:mm:ss'), @julian type info to client;
end if;
/*
execute immediate with quotes
'insert into sys_suppdata (property, value, key_name)
location ''' || @supp_server || '.' ||... (5 Replies)
well, i am so not familiar with this kind of things but i am gonna explain extactly what i am looking for so hopfully someone can figure it out :)
i have a command that shows memory usage besides the process name, for example(the command output):
500 kb process_1
600 kb process_2
700 kb... (4 Replies)
Hi
I have a script where the user calls it with arguments like so:
./import.sh -s DNSNAME -d DBNAME
I want to check that the database entered is valid by going through a passwd.ds file and checking if the database exists there.
If it doesn't, the I need to send a message to my log... (4 Replies)
I hava a file with following data:
number|CREDIT_ID|NULL
date|SYS_CREATION_DATE|NULL
varchar2|GGS_COMMIT_CHAR|NULL
varchar2|GGS_OP_TYPE|NULL
number|GGS_SCN|NULL|
number|GGS_LOG_SEQ|NULL
number|GGS_LOG_POS|NULL
number|GGS_ORACREC_SCN|NULL
varchar2|BATCH_ID|NULL
char|GGS_IMAGE_TYPE|NULL
... (6 Replies)
Hi All,
I have a file like this,(This is a sql output file)
cat query_file
200000029
12345 10001
0.2 0
I want to fetch the values 200000029,10001,0.2 .I tried using the below code but i could get... (2 Replies)
Here is my problem. I have to find the differences in 2 XML files
This is my Old File contents - File1
<FILEHDR>
<Bag xsi:nil='true'></Bag>
</FILEHDR>
This is my New File contents - File2
<FILEHDR>
<Bag xsi:nil='true' ></Bag>
</FILEHDR>
When I do the following
diff -b File1 File2... (1 Reply)