Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.

Filter output in curl

Login or Register to Reply

Thread Tools Search this Thread
# 1  
Filter output in curl

Hello guys,

I'm writing a little script which sends me sms with my shell script via api of a sms provider.

problem is I can't filter my curl output for this site:

site url:

this is what i got so far, but I don't know how to filter everything out, I just want the times and also only the "ab time" like
05:08 ab

echo "Now:" `date +%H:%M:%S`
for URL in $URLS; do
echo "$URL:" | sed 's/.*=.*=/Route /'
curl -s $URL \


# 2  
Once again I haul out my micro xml parser for these questions... It looks like you want the contents of the very first <div class="planed">...</div> block.

$ cat planed.xml


NR==1 { next } # The first "line" is blank when RS=<
/^[!?]/ {       next    }               # Skip XML specification junk
{       gsub(/[\r\n]*$/, " ");  }       # Clean up newlines

# Handle open-tags
match($0, /^[^\/ \r\n\t>]+/) {
        TAG=substr(toupper($1), RSTART, RLENGTH);
        TAGS=TAG "%" TAGS;

# Handle close-tags
/^[\/]/ {
        sub(/^\//, "", $1);
        sub("^.*" toupper($1) "%", "", TAGS);

(TAGS ~ /^DIV%/) && ($1 ~ /planed/) {
        gsub(/[\r\n]/, "", $2);
        print $2;

$ awk -f planed.awk input.html

05:08 ab


The code highlighted in red is the statement which extracts the tag you want. The rest is generic XML parsing code.
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Filename output in curl
How can I get the name of the default output filename from curl using the argument -O? Using -o one can choose a filename. I want to get the name of the original file, but don't understand how to get it. curl -o filename curl -O The...... Web Development
Web Development
Extracting urls from curl output
Hello. I use curl to fetch a website, then, I want to extract the URLs from this curls output. I tried both sed and grep, but couldnt figure it out. Ive tried : sed -n 's/href="\(*\).*/\1/p' results.txt and grep -o grep -o '<a href="http://*.*.*/*">' results.txt. What pattern...... Shell Programming and Scripting
Shell Programming and Scripting
Encapsulating output of CURL and/or WGET
i use curl and wget quite often. i set up alarms on their output. for instance, i would run a "wget" on a url and then search for certain strings within the output given by the "wget". the problem is, i cant get the entire output or response of my wget/curl command to show up correctly in...... Shell Programming and Scripting
Shell Programming and Scripting
Getting cURL to output verbose to a file
This is about to drive me crazy. What I want to do is simple: output ALL the verbose information from curl to a file I have read the manual, tried several options and searched this forum but no salvation... I'm using curl -k -Q "command" --user user:passwd --ftp-pasv --ftp-ssl -v...... Shell Programming and Scripting
Shell Programming and Scripting
script to output curl result as html
hi, new to scripting and would like to know how can I have a script which will curl a few URLs and have the results such as the URLs being curled, dns lookup time, connection time, total time, etc save in a html format in a form of table with column and rows. thank you.... Shell Programming and Scripting
Shell Programming and Scripting

Featured Tech Videos