Solved

Sending last line of txt document using blat

Posted on 2008-06-18
8
409 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

623 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