1.

Solve : Batch script to remove email user names?

Answer»

I am stuck on what should be a simple script.

I want to remove the username and from a list of EMAILS from a txt file and put the domain names in another file

EX -
emails.txt
[email protected]
[email protected]
[email protected]

put the domain names in an existing txt file >> domains.txt

mail1.com
mail2.com
bar.com
foo.com
panic.com Quote

OS: Linux variant


What OS are you using?
DOH! Just noticed that.  This is for a Win 7 machine.
I already have a Linux Shell script that does the same thingTry this:

Code: [Select]echo off
setlocal enabledelayedexpansion

(for /f "usebackq delims=" %%a in ("emails.txt") do (
   set "var=%%a"
   echo(!var:*=!
))>>"domains.txt"
PAUSE
Foxidrive,
Why didn't you just use the as a delimiter?
Code: [Select]for /f "usebackq tokens=2 [email protected]" %%G in ("emails.txt") do echo %%G >>domains.txt Quote from: foxidrive on SEPTEMBER 29, 2014, 10:47:38 PM
Try this:

Code: [Select]echo off
setlocal enabledelayedexpansion

(for /f "usebackq delims=" %%a in ("emails.txt") do (
   set "var=%%a"
   echo(!var:*=!
))>>"domains.txt"
pause


Thank You!!! Quote from: Squashman on September 30, 2014, 07:35:18 AM
Foxidrive,
Why didn't you just use the as a delimiter?

I must be getting old - it didn't occur to me.

       Quote from: foxidrive on September 30, 2014, 08:44:27 AM
I must be getting old - it didn't occur to me.
It sucks getting old. Some days I walk into the KITCHEN and don't even remember why I went to the kitchen.When i bent over to TIE my shoes this AM i thought to myself..."what else can i do now i'm down here" ? ?Well at least I don't have trouble with my 1's and 2's.

I have a solid leak every morning at 7am, and a full bowel motion every day at 7:30 am.

Pity I don't get out of bed until 8am...


Discussion

No Comment Found