cURL / Mailing Lists / curl-users / Single Mail

curl-users

output format

From: Alex da Franca <alex_at_farbflash.de>
Date: Mon, 5 Sep 2005 15:59:25 +0200

Hi all,

I am feeling pretty stupid at the moment, but being a novice at OSX
terminal I can't figure out, why I am stuck or better spoken, what I
am doing wrong. please excuse, if this question is much too basic,
but I did search already, but it may be that stupid, that I even
can't figure out what to search for ;-)

here's the problem:

I am requesting a file listing via ftp and show only lines which
contain the string "access" (the log directory)
I tried all sorts of "stupid tricks" I could come of to have a simple
list of matching items.
last thing I tried was writing the output to a temporary file and
remove that file afterwards.
although I can "cat" the file and display the results a simple loop
through the lines of the file fails.
I am sure, it has to do with some sort of "carriage return" put int
by curl, but I don't know how to deal with that due to my
unexperienceness with shell scripting.
here's the bit of the script, which doesn't work:

theURL="ftp://${user}:${answer}@www.${server}.de/logs/"
curl -l ${theURL} | grep access >> tempfile
cat tempfile ###### <-- this works as expected on STDOUT

###### the following doesn't :-(

for thisurl in `cat tempfile `
     do
     echo $thisUrl
     echo linebreak
done

###### BUT if I do the same after the script execution terminated, it
works again on the same file (-> tempfile)

my out put in the terminal looks like:

Connecting to server...
   % Total % Received % Xferd Average Speed Time Time
Time Current
                                  Dload Upload Total Spent
Left Speed
100 35206 0 35206 0 0 29113 0 --:--:-- 0:00:01
--:--:-- 63757
access.log.28.gz
access.log.32.gz
access.log.29.gz
access.log.31.gz
access.log.30.gz
access.log.35.gz
access.log.33.gz
access.log.34.gz
access.log.36.1

linebreak

linebreak

linebreak

linebreak

linebreak

linebreak

linebreak

linebreak

linebreak

#################### the same file after the script finished:

for item in `cat tempfile` ; do echo $item ; echo linebreak ; done
access.log.28.gz
linebreak
access.log.32.gz
linebreak
access.log.29.gz
linebreak
access.log.31.gz
linebreak
access.log.30.gz
linebreak
access.log.35.gz
linebreak
access.log.33.gz
linebreak
access.log.34.gz
linebreak
access.log.36.1
linebreak

must be a stupid little mistake or a switch in curl... ?

TIA

Best regards

  --------------- Alexander da Franca --------------
  Multimedia Developer_______________________Lingo Programmer
  --------------- http://www.farbflash.de --------------
Received on 2005-09-05