here is the scenario
input.txt
Code: Select all
field1 field2 field3
AAAA BBBB CCCC
DDDD
EEEE FFFF
GGGG HHHH
Those empty one shall put a NULL inside
something like this,,
output.txt
Code: Select all
field1 field2 field3
AAAA BBBB CCCC
DDDD NULL NULL
EEEE FFFF NULL
GGGG NULL HHHH
## take note the field2 and field 3 space is different.. field 1 is almost with content hence the script just has to tackle field 2,3
My approach is to count the character until field 2 (12character from left) then check if is empty insert NULL. Then continue for field 3 (29 character from left) check if is empty insert null
Code: Select all
@echo off
set line =
for /F in(input.txt) do
if "!line :~ 12" eq " " do
write null (i not sure whether is correct)
if "!line:~ 29 " eq " " do
write null
echo > output.txt
Would appreciate if anyone can guide me on this..
thanks