I will appreciate if you help me here in this script in Solaris Enviroment.
Scenario:
i have 2 files :
1) /tmp/TRANSACTIONS_DAILY_20180730.txt:
201807300000000004
201807300000000005
201807300000000006
201807300000000007
201807300000000008
2) /opt/TRANSACTIONS_DAILY_20180730.txt
20180730|201807300000000005||50001521111200|0106276-4|5SIJ00|WIRE||EUR|EUR|20180730|20180730|||||||0000000000030 0.00|00000000000300.00|Credit||||||||||SIJ|||500015|506|||||||||||||||||||||||||FI3158410220205399||||FI|SME5
20180730|201807300000000005||50001521111200|0106276-4|5SIJ00|WIRE||EUR|EUR|20180730|20180730|||||||00000000000300.00|00000000000300.00|Credit||||||||||SIJ|||500015|506|||||||||||||||||||||||||FI3158410220205399||||FI|SME5
20180730|201807300000000006||50001521111200|0106276-4|5SIJ00|WIRE||EUR|EUR|20180730|20180730|||||||00000000000050.00|00000000000050.00|Credit||||||||||SIJ|||500015|506|||||||||||||||||||||||||FI3650005020017008||||FI|SME5
20180730|201807300000000007||50001521111200|0106276-4|5SIJ00|WIRE||EUR|EUR|20180730|20180730|||||||00000000000015.00|00000000000015.00|Credit||||||||||SIJ|||500015|506|||||||||||||||||||||||||FI1958410220026068||||FI|SME5
20180730|201807300000000008||50001521111200|0106276-4|5SIJ00|WIRE||EUR|EUR|20180730|20180730|||||||00000000000300.00|00000000000300.00|Credit||||||||||SIJ|||500015|506|||||||||||||||||||||||||FI8358410220212320||||FI|SME5
i) I want to read each line of the first file and if this "string" line will exist to the second file will put whole transaction of the second file to a new file.
ii) This new file that is created we will count the " | " characters in each line and if they more than 64 in each line , the 61 " | " in the specific line will be deleted.
I have managed to do the i) part of the script but i need help for the ii) part.
MY code until now for i) part which works:
#!/bin/bash
while read line
do
grep "$line" /opt/TRANSACTIONS_DAILY_20180730.txt
done < /tmp/TRANSACTIONS_DAILY_20180730.txt > tmp/TRANSACTIONS_DAILY_NEW_20180730.txt
This specific Solaris enviroment doesnt support sed -r option neither grep -f or grep -o