If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > SED Help!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-31-04, 12:52
ronj6469 ronj6469 is offline
Registered User
 
Join Date: Oct 2004
Posts: 2
Question SED Help!!

Just downloaded sed-Win32 version from WindowsITPro. Created a Windows bat file in order to ftp files to a remote server. The bat file generates a ftp source file. Trying to use sed to add the "put" command in front of each file name in the ftp source file. example:

My current output
=============
open 192.168.1.1
myusrname
mypasswd
hash
bin
file1.txt
file2.txt
file32.txt
bye
===========

Desired output
=============
open 192.168.1.1
myusrname
mypasswd
hash
bin
put file1.txt
put file2.txt
put file32.txt
bye
===========

Then
c:\>ftp -i -sutput.txt

Tried several variations of sed command, but with no luck. Windows version lack many of the functions that Unix supports.

Any suggestions, ideas and help would be greatly appreciated.

Thanks

Ron
Reply With Quote
  #2 (permalink)  
Old 10-31-04, 14:00
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
to get you started:

sed -e 's!.*\.txt$!put &!g' myFile
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 10-31-04, 15:37
ronj6469 ronj6469 is offline
Registered User
 
Join Date: Oct 2004
Posts: 2
Thanks,
command works great on Linux. Now if I can only find a decent Win32 version that supports the command arguments. You pointed me in the right direction anyway. Thanks again.

Ron
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On