Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending last line of txt document using blat

Posted on 2008-06-18
8
Medium Priority
?
415 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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 2000 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

Google Certified Professional - Cloud Architect

This course (1 of 3) is designed to help students who are interested in Google Cloud Platform (GCP) to become familiar with the platform, navigate the console and learn its capabilities. It will also prepare students for the Google Cloud Architect certification exam.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
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…

688 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