Skip to content

Instantly share code, notes, and snippets.

@alexandre-mbm
Created August 25, 2017 00:18
Show Gist options
  • Save alexandre-mbm/3d2c5272a853ee45b4be3040f60d479c to your computer and use it in GitHub Desktop.
Save alexandre-mbm/3d2c5272a853ee45b4be3040f60d479c to your computer and use it in GitHub Desktop.
#!/bin/bash
URL="http://www.sine.rn.gov.br/Conteudo.asp?TRAN=ITEM&TARG=21137&ACT=&PAGE=0&PARM=&LBL=Vagas"
HTML=$(wget -q "$URL" -O- | html2text | iconv -f ISO_8859-1 -t UTF8)
#echo "$HTML" | grep "Total" | awk '{ print $2 } ' | head -n 1
#echo "$HTML" > sine.txt
N=$(echo "$HTML" | awk '/VAGAS PERMANENTES/{print NR}' | head -n 1)
M=$(echo "$HTML" | awk '/Total/{print NR}' | head -n 1)
N=$(expr $N + 3)
M=$(expr $M - 1)
echo "$HTML" | sed $N,$M!d
#cat sine.txt | awk 'BEGIN { RS="VAGAS PERMANENTES"; FS="Total"; } { print $1 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment