.bat script help

 
Thread Tools Search this Thread
Special Forums Windows & DOS: Issues & Discussions .bat script help
# 1  
Old 11-22-2010
Question .bat script help

hi
I need to rediret an content of one file and append it to another file. I need it in .bat script. I tried this,

first.txt
Code:
I love to write script

Code:
type first.txt >> out.txt
type first.txt >> out.txt

out.txt
Code:
I love to write scriptI love to write script

you see the second append go in the same line.I need to print the second append to go in the next line.Like this
Code:
I love to write script
I love to write script

Can oneone help me.

also let me know the perl coding for this.

thanks...
Gopal

Moderator's Comments:
Mod Comment Start using code tags when posting code, data or logs etc., thanks. You got a PM with a guide.
# 2  
Old 11-22-2010
Didn't the detailed answer from bakunin here help you? What was not clear?
# 3  
Old 11-22-2010
.bat script help

His/her explaination was too gud. But i need the exact code. Let me know if have the same.

Thanks.
Gopal
# 4  
Old 11-22-2010
bakunin was telling you that the file "first.txt" was not a correctly formatted MSDOS text file because there was no line terminator on the record. Just edit the file with notepad and ensure that you press carriage-return at the end of the last record.
This fixes your Batch Program.

Just for interest it also fixes the more conventional way of achieving the same effect which is to use the "copy" command:
Code:
copy first.txt+first.txt out.txt

# 5  
Old 11-22-2010
Error .bat script help

not being smart in .bat scripts. first.txt file is automatically generated by SQL. I need to copy these content to another file May be u can say i should append to another file (out.txt).
so i dont have any control over editing the file.
If you have this situation what best you could've done for this.

Thanks...
Gopal
# 6  
Old 11-24-2010
What I would do:

1) Create a text file with notepad containg only a blank line.
(Open the file in notepad and press the return key)
Code:
notepad cr.txt

2) Either correct the format of the original file (or a copy of that file) by appending the missing terminator.
Code:
type cr.txt >> first.txt

Or insert the missing terminator when we need it.
Code:
copy first.txt+cr.txt+first.txt+cr.txt out.txt

Or to parody the original post.
Code:
type first.txt >> out.txt
type cr.txt >> out.txt
type first.txt >> out.txt
type cr.txt >> out.txt

# 7  
Old 01-12-2011
Code:
type first.txt >> out.txt
echo. >> out.txt
type first.txt >> out.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Convert .sh to .bat please

Can someone translate this code to .bat for me? I have no clue. #!/bin/sh WAS_HOME="/opt/websphere/appserver/profiles/AppSrv01" WAS_APP_SERVER="server1" WAS_PROFILE_NAME="AppSrv01" echo "Stopping App Server" "${WAS_HOME}/bin/stopServer.sh" -profileName $WAS_PROFILE_NAME $WAS_APP_SERVER... (1 Reply)
Discussion started by: Blogger11
1 Replies

2. Shell Programming and Scripting

BAT to SH help

First off, let me apologize if I'm posting this in the wrong place! I am a newbie to this forum, to shell scripting and to Linux so please bare with me. I created a script on the windows environment that makes a call to a java application and extracts a return value from the java app. It... (7 Replies)
Discussion started by: arod291
7 Replies

3. Shell Programming and Scripting

Need help with bat file!!!

I need to put/get files from Windows machine to Unix machine and vice-versa. I wrote a text file "ftp1.txt" as below. naga naga06 cd /root/Naga prom off get time.unl bye I wrote another bat file "ftp.bat" as below. ftp -n -s:C:\Users\Naga\Desktop\ftp1.txt IP_ADDRESS but... (2 Replies)
Discussion started by: Naga06
2 Replies

4. Shell Programming and Scripting

bat to shell

I have serverfiles of same game. and there are bat files. I wont to run this on debian. The files are difficult, eg :######################################################################## :# File name: server_start.bat :# Edited Last By: Mike Gleaves (ric) :# V 1.0 1-10-2008 :# Comment:... (5 Replies)
Discussion started by: Qentinios
5 Replies

5. Windows & DOS: Issues & Discussions

Executing .bat file

Hi , I have a bat file on windows machine ,I need to excute it from my local unix machine using sambe utility.Is there any comman to execute the .bat file remotely. Using samba utility i can post files to and fro from windows to unix but i don't comman to exute the .bat file. can any one... (2 Replies)
Discussion started by: Raamc
2 Replies

6. Shell Programming and Scripting

.bat or .pl script help

hi I need to rediret an content of one file and append it to another file. I need it in .bat script. I tried this, first.txt I love to write script type first.txt >> out.txt type first.txt >> out.txt out.txt I love to write scriptI love to write script you see the second... (1 Reply)
Discussion started by: ilugopal
1 Replies

7. Windows & DOS: Issues & Discussions

Calling a .bat file using Korn script

Hi all, I am a very new user for korn scripting and in a process of learning. i have a .bat file that calls a .vbs file which calls a macro used to convert an excel spread sheet to .csv file... Now i want to automate this process. I want to call this bat file using a korn script or a korn... (6 Replies)
Discussion started by: bhagya2340
6 Replies

8. Windows & DOS: Issues & Discussions

one question for .bat file

Hi! I'm very sorry for such simple and silly question but I cannot answer it by myself. Can you please help me? In .bat file I should run the C program which is in other directory, and the input configuration file is in this directory too. This dir name is in dirRun variable. The... (3 Replies)
Discussion started by: Anta
3 Replies

9. Shell Programming and Scripting

Run shell script from .bat file

hi how can I execute a shell script on unix server from a .bat file of windows desktop?? Regards. (3 Replies)
Discussion started by: Chaitrali
3 Replies

10. UNIX for Dummies Questions & Answers

Can Unix (Solaris) execute a dos .bat script?

I did a search and found lots of questions/comments about how a dos script could execute Unix but not the other way round. If it's possible, I'd like the link to a post/site that would show me the way. Thanks. (4 Replies)
Discussion started by: BCarlson
4 Replies
Login or Register to Ask a Question