hi everyone,
i am a newbie in shell programming. and i want to simply go through a text file that contains 3 "columns", split by ';'
customerID ; link-to-contract ; save-as-filename
so an example would simply look like this
now i want to loop through every line, and save the file from the link as the name given at the end....how is best way and shortest way to do this?
thanks in advance.
zaxxon
February 7, 2011, 8:12am
2
If the example has a typo, ie. 1st and 2nd field are separated by a semicolon instead of a colon, as described in your text, you could do something like this:
while read LINE; do
A=`echo $LINE| cut -d";" -f2`
echo ${A##*/}
done < infile
Result would be:
mypic.tff
mypic2.tff
thanks a lot
but it does not work well with real links like
dp1.mylink.com:8083/doaFile/permalink?l8nj2BnEo34Pa
(the file behind the link is actually a tiff file)
zaxxon
February 7, 2011, 11:48am
4
With bash:
while read LINE; do A=`echo $LINE| cut -d";" -f2`; echo ${A##*[?/]}; done < infile
mypic.tff
mypic2.tff
l8nj2BnEo34Pa