Solved

Sending last line of txt document using blat

Posted on 2008-06-18
8
407 Views
Last Modified: 2012-05-05
I am trying to send the last line of last_line.txt using Blat. What I have right now sends me the whole txt document in the body. I dont want all that because there our multiple lines. I just want the last line of last_line.txt. Here is what I have in my test.cmd file:

blat.exe "last_line.txt" -subject "A Screen Saver has been Changed" -to 123@mail.com -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain


Any help is much appreciated. Thanks!
0
Comment
Question by:missywpitt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 38

Expert Comment

by:Shift-3
ID: 21816746
This should do it.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body=%%G
 
blat.exe -subject "A Screen Saver has been Changed" -body "%body%" -to 123@mail.com -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
 

Author Comment

by:missywpitt
ID: 21816870
when I try and run it it says -subject does not exist.
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 21816889
Oh, I guess the -to switch has to go first.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body=%%G
 
blat.exe -to 123@mail.com -subject "A Screen Saver has been Changed" -body "%body%" -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

Author Comment

by:missywpitt
ID: 21816958
Now I got -to does not exist. I think the file itself has to b put after blat? When I run my code I had before it works except I get everything that is in the text file rather than just the last line like I want. Not sure about this one.

I have a work around if we cant get it.
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 21817044
After re-reading the Blat documentation (http://www.blat.net/syntax/syntax.html), I'm pretty sure this will work.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body=%%G
 
blat.exe - -body "%body%" -to 123@mail.com -subject "A Screen Saver has been Changed" -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
 

Author Comment

by:missywpitt
ID: 21817200
well that sent me the second line of the text document? Atleast were getting somewhere here.
0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 500 total points
ID: 21817308
Perhaps there is an ampersand or something messing it up.

Last try.


@echo off
setlocal enabledelayedexpansion
 
for /F "tokens=* usebackq" %%G in (last_line.txt) do set body="%%G"
 
blat.exe - -body %body% -to 123@mail.com -subject "A Screen Saver has been Changed" -i ScreenSaver -priority 1 -server smtp.mydomain.com -f wpdomain

Open in new window

0
 

Author Comment

by:missywpitt
ID: 21821426
That worked! Once again Shift-3 you pulled through!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
troubleshoot a python script 8 114
Permission on folders 6 35
How to write a *nix script in the most generic and compatibile way 2 34
Cannot exit IF statement in PowerShell 4 47
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question