If you need more info just ask please, I will give you any info needed. Thank you for reading this and helping me out! It's very appreciated

Moderator: DosItHelp
Code: Select all
1 2
2 4
3 7
4 9 00
5 9
6
79 9
8 9 111
9
099 1
Code: Select all
@echo off
findstr /v /c:"4 9 00" /c:"1 2" Sample.txt
::/C is really strict in spaces.
::Also there is echo. below because findstr doesnt have CRLF thingy in last line...
echo.
pause
Code: Select all
2 4
3 7
4 9 00
5 9
6
79 9
8 9 111
9
099 1
Press any key to continue . . .
Meerkat wrote:Hope this helps!![]()
![]()
Sample.txtCode: Select all
1 2
2 4
3 7
4 9 00
5 9
6
79 9
8 9 111
9
099 1
Now, put this BAT file on the same directory w/ Sample.txtCode: Select all
@echo off
findstr /v /c:"4 9 00" /c:"1 2" Sample.txt
::/C is really strict in spaces.
::Also there is echo. below because findstr doesnt have CRLF thingy in last line...
echo.
pause
Output:Code: Select all
2 4
3 7
4 9 00
5 9
6
79 9
8 9 111
9
099 1
Press any key to continue . . .
Now, just redirect the output to the another text file if you want.
Code: Select all
findstr /c:"%Account%" Sample.txt
ShadowThief wrote:Actually, if you do what Meerkat suggested, it will work perfectly for what you want.
Code: Select all
Zixefer
Haxs4life
test
admin
username
test2
accountName
Code: Select all
@echo off
set "file_accounts=Account.txt"
:sample_loop
cls
echo.Accounts:
echo.
type "%file_accounts%"
echo.
echo.
set /p delete_usr=Enter the account to delete:
::The main processor
for /f "tokens=*" %%X in (
'findstr /v /e /b /c:"%delete_usr%" "%file_accounts%" ^&del "%file_accounts%"'
) do (
echo %%X>>%file_accounts%
)
goto :sample_loop
Code: Select all
Accounts:
Zixefer
Haxs4life
test
admin
username
test2
accountName
Enter the account to delete:
Code: Select all
Accounts:
Zixefer
Haxs4life
admin
username
test2
accountName
Enter the account to delete:
Code: Select all
::The main processor
findstr /v /e /b /c:"%delete_usr%" "%file_accounts%" > tempfile.tmp
move /Y tempfile.tmp "%file_accounts%"
goto :sample_loop
Meerkat wrote:Actually, there is no direct method in pure Batch to directly delete a line in a file. However, Batch provides an alternative that could be done.
[snip]
Meerkat
Aacini wrote:@Meerkat, it is slightly simpler this way:
[snip]
Antonio