0
In my scenario i need to check my file (XXX.txt
) for the word "SPOT".
There will be few of SPOT word in the file.
Now i need a script to write the top 2 line of the "SPOT" word in a new text fine and name it as "done.txt
".
EXAMPLE XXX.txt
dfsfs
clip_id HDX
title Setiap hari
type PROMO
end
clip_id HDQ
title Citra
type SPOT
end
clip_id HDX
title Ri
type PROMO
end
clip_id HDX
title sni
type SPOT
so i need to write "done.txt
" as per below.
clip_id HDQ
title Citra
clip_id HDX
title sni
Please advise for script to do this.
Many thanks
Welcome to Super User. Unfortunately, we are not a code-writing service. Instead of simply asking for code to perform a particular task, please show us what you've tried so far (including any code you currently have) and where you're stuck so that we can help you with your specific problem. Questions that only ask for code are too broad and are likely to be put on hold or closed
– DavidPostill – 2015-03-19T07:42:17.900For a pure CLI
– JosefZ – 2015-03-19T09:34:22.527.bat
solution, you could start with comparing output fromfindstr /n /i "spot" "xxx.txt"
command and fromfindstr /n /R $ "xxx.txt"
and then treat it in two nestedFOR /F
loop commands. Feel free to return here and [edit] your question following @DavidPostill comment hint.