IsraelTorres icon

get-dell-elements.sh

IsraelTorres | PRO | 11/09/11 10:40:49 PM UTC | 0 ⭐ | 448 👁️ | Never ⏰ | []
Bash |

760 B

|

None

|

0 👍

/

0 👎

#/bin/bash
# ./get-dell-elements.sh
# Israel Torres 20110307
# Dell multiple hooks at one time with one file
 
dellurl='http://support.dell.com/support/topics/global.aspx/support/my_systems_info/en/details?c=us&cs=04&l=en&s=hied&ServiceTag='
tempfile=$(date +%s)
filter1="System Type:"
filter2="Ship Date:"
 
for SN in $(cat dell.txt)
    do 
    #echo -ne "$SN\t"
    curl -s $dellurl$SN | tr "\"" "\n" > $tempfile
    DellSysType=$(cat $tempfile | grep "$filter1" -A 4 | grep '</td></tr><tr><td class=' | sed 's/<\/td><\/tr><tr><td class=//g' | sed 's/>//g')
    DellShpDate=$(cat $tempfile | grep "$filter2" -A 4 | grep '</td></tr><tr><td class=' | sed 's/<\/td><\/tr><tr><td class=//g' | sed 's/>//g')
    
    echo -e "$SN\t$DellSysType\t$DellShpDate"
done
 
rm -f tempfile
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎