I need to create a bash script that reads a txt file on a remote (Windows 2003) server, gets the IP-addresses out of it and then fetches the folders to copy out of another txt file. (all files are auto-generated) The IP addresses that don't have a folder_list file should be ignored. At the moment I can get my txt via FTP and read it out.
I would already be very happy if I had a script that could ECHO the folders based on the ftpservers.txt file, later on I will use this to transfer the folders via FTP.
It's kind of complicated, but please check the attachment (JPEG)
This is an example of the layout of the main file: ftpservers.txt ; contains the IP-addresses, usernames and password. Only the 1st,4th,7th,10th,13th,16th,... line are important in the first place.
In the same folder there are some files (4 at the moment) named for example 212.114.xxx.xxx_folderlist. Where the first part is the IP address. These files contain the folders
Thanks in advance to help me out here.
Please ask me if you need more information.
Thanks for your reply Franklin,
It looks like a solid line of code, though, it gives me this output:
This is my bash script so far:
I would also need a line that gets all the files with the .TXT extension.
Thanks in advance
Btw, I understand asking you guys to write the whole script is quite impossible but I would already be glad with the first steps. step by step...
Can you post a part of the file ftpservers.txt and the desired output within code tags?
Regards
The file: ftpservers.txt
For the _folderlist.txt files; they look like this:
The thing I would like to have for now is that the folders would be displayed.
Thus, when I execute my bash script ./bash.sh , I should get something like:
The output of this shouldn't necessarily be the same (layout) but the most important is that it shows the folder paths.
I hope you understand now what it should be doing.
i would like to insert a line from 2.txt into 1.txt between " and "
or a way of adding to the end of each line " _01_ and have the numbers
correspond to the line #
1.txt=
foofoo "" _01_
foofoo "" _02_
foofoo "" _03_
foofoo "" _04_
2.txt= ... (6 Replies)
Dear all,
I have a huge txt file (DATA.txt) with the following content . From this txt file, I want the following output using some shell script.
Any help is greatly appreciated.
Greetings,
emily
DATA.txt (snippet of the huge text file)
407202849... (2 Replies)
I'm attempting to write a bash script that will create a network between virtual machines. It accepts three arguments: an RSpec that describes the network topology, and two list of machines (servers and clients).
I have a (working) Perl script that I want to call. This Perl script takes an RSpec... (6 Replies)
Hi All,
Just have a requirement, I am executing a bash shell script, my requirement is to catch the pid and job name to a txt file in the same directory, is there anyway to do it? please help me out.
Regards
Rahul
---------- Post updated at 08:42 AM ---------- Previous update was at... (2 Replies)
I want to add/append the info in the following format to my.txt file.
20130702|abcd20130702.txt FN|SN|DOB
I tried the below script but it throws me some exceptions.
<#!/bin/sh
dt = date '+%y%m%d'members;
echo $dt+|+members+$dt;
/usr/bin/awk -f
BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
This is appending a column.
My question is fairly simple. I have a program generating data in a form like so:
1 20
2 22
3 23
4 12
5 43
For ever iteration I'm generating this data. I have the basic idea with cut -f 2 fileA.txt | paste -d >> FileB.txt ???? I want FileB.txt to grow, and... (4 Replies)
This took me quite awhile to find so I wanted to share this with other people.
To switch windows in vimdiff or
to navigate windows in vimdiff or
to change windows in vimdiff try the following:
The ":vertical" command can be inserted before another command that
splits a window.
... (0 Replies)
I am writing a script to write to and a sort txt file. After I sort the file I want to add 2 to each line of the file. My script thus far is
#!/bin/bash
cat > /ramdisk/home/stux/unsortedints.out
COUNT=0
FILE =/ramdisk/home/stux/unsortedints.out
for i in {1..100}
do
NUMBER = $
echo $NUMBER... (3 Replies)
If I cat a file
And want to go to the first instance of a particular value - what command would I use?
And then from that point where I jumped to search for another value - but only search from that point forward not before the file?
Thanks~ (2 Replies)
Hi,
I have already read a lot of posts on sending attachments in unix...but none of them were of help for my problem...so here goes..
i wanna attach a text file and send to a mail id..used the following code :
uuencode "$File1" "$File1" ;|mail -s "$Mail_sub" abc@abc.com
it works... (2 Replies)