Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-24-2007, 11:30 AM   #1
LQ Newbie
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
Linux FTP and "Put"

I am trying to upload a text file by running a batch file that moves a file from my system to an as/400 server. The problem I am having is the batch file needs to execute everyday but the file being uploaded changes everyday. My program that I developed writes a text file where the first line is the name of the file to be uploaded. This file will change as the date changes. Ex.

ccf0_0711070138.csv - Day one
ccf0_0712070138.csv - Day two

I need a command that can read this text file(which will only contain the one line -the filename) and use this name for the "put" command.

i believe it is --- put <variable> <variable>

So the <variable> areas will change from day to day based on what gets written to that text file. If you could help me that would be great.

More or less i need a command that can read the text file and input that text into a command.

Last edited by dburesh; 07-24-2007 at 11:55 AM.
Old 07-24-2007, 07:39 PM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.3
Posts: 17,548

Rep: Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423Reputation: 2423
If the filename file only contains one line you could go with:
file_to_put=$(cat file_containing_name)

If it's the first line
file_to_put=$(head -1 file_containing_name)

Last line
file_to_put=$(tail -1 file_containing_name)

then use that variable in the rest of your script.
Old 07-25-2007, 08:20 AM   #3
LQ Newbie
Registered: Jul 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the help....Thats all I needed!!!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
ndiswrapper worked fine "ESSID:off/any" ??? cant put in an ssid?? fatrandy13 Linux - Wireless Networking 12 08-21-2011 11:32 PM
How can I put "Wave" music files on a AUDIO CD to play in my car? Balarabay1 SUSE / openSUSE 4 05-22-2006 10:19 PM
How do I put my entire system into "root", not just the konsole? GameGuru Linux - Newbie 11 07-04-2005 01:21 PM
C -communicating with system("ftp"); using "program|ftp>>myfifo" probably hansschmucker Programming 1 03-23-2005 01:39 PM
Judge finally tells SCO to "put up or shut up" Capt_Caveman General 5 12-07-2003 10:09 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration