Visit Our UNIX and Linux User Community

Grep/Awk WGet Time

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep/Awk WGet Time
# 1  
Old 08-11-2009
Grep/Awk WGet Time

I am trying to grep/awk how long it takes to get a page. I am trying to use the following command.

time -p wget -q -O wget.tmp 2>&1 | grep real

The problem is that my attempts to map stderr to stdout are being applied to wget not to time so all of the time output is displayed on the console and grep gets no input.

I have tried using the output parameters on time and an got error. (Same for --ouput.)

time -p -o time.tmp wget -q -O wget.tmp 2>&1 
bash: -o: command not found
real 0.00
user 0.00
sys 0.00

The interesting thing about the last example is that if I had include the pipe to grep, I would not have seen the bash error but would have still seen the times confirming that the piping of stderr to stdout is not being applied to time.

# 2  
Old 08-11-2009

And if you enclose the time in brackets?

(time -p wget -q -O wget.tmp 2>&1 | grep real

# 3  
Old 08-11-2009
Thanks, new had to be a simple solution.


Previous Thread | Next Thread
Test Your Knowledge in Computers #959
Difficulty: Medium
The first virus attack against a Linux machine was by a virus called Stooge,
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Wget, grep, sort, sed in 1 command/script

Hi, I need to join these statements for efficiency, and without having to make a new directory for each batch. I'm annotating commands below. wget -q -r -l1 URL ^^ can't use -O - here and pipe | to grep because of -r grep -hrio "\b\+@\+\.\{2,4\}\+\b" * > first.txt ^^ Need to grep the output... (14 Replies)
Discussion started by: p1ne
14 Replies

2. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

3. Shell Programming and Scripting

Awk: time intervals based on epoch time

I have a list of epoch times delimited by "-" as follows: 1335078000 - 1335176700 1335340800 - 1335527400 1335771300 - 1335945600 1336201200 - 1336218000 The corresponding dates are: 20120422 1000 - 20120423 1325 20120425 1100 - 20120427 1450 20120430 1035 - 20120502 1100 ... (3 Replies)
Discussion started by: alex2005
3 Replies

4. Shell Programming and Scripting

Wget in bash using sed and awk

In the bash below when the program is opened the download function runs and downloads the getCSV file and on the screen "Downloading getCSV.csv:%" displays and when it completes the menu function is called. However, as of now the bash opens and closes after a few seconds and I'm not sure... (4 Replies)
Discussion started by: cmccabe
4 Replies

5. Programming

Find gaps in time data and replace missing time value and column 2 value by interpolation in awk

Dear all, I am kindly seeking assistance on the following issue. I am working with data that is sampled every 0.05 hours (that is 3 minutes intervals) here is a sample data from the file 5.00000 15.5030 5.05000 15.6680 5.10000 16.0100 5.15000 16.3450 5.20000 16.7120 5.25000... (4 Replies)
Discussion started by: malandisa
4 Replies

6. Shell Programming and Scripting

Wget takes a long time to complete

Hi, I wish to check the return value for wget $url. However, some urls are designed to take 45 minutes or more to return. All i need to check if the URL can be reached or not using wget. How can i get wget to return the value in a few seconds ? (8 Replies)
Discussion started by: mohtashims
8 Replies

7. Shell Programming and Scripting

Time outputs of wget command

Hello friends, I've been working on a solaris server, I need to test responses of a web service using WGET command, if the response is successful, how quick it is etc. I have scirpt like this, I modified it, i try to redirect the output of time command to total.txt but i couldn't manage, i... (4 Replies)
Discussion started by: EAGL€
4 Replies

8. UNIX for Dummies Questions & Answers

Converting string date time to unix time in AWK

I'd like to convert a date string in the form of sun aug 19 09:03:10 EDT 2012, to unixtime timestamp using awk. I tried This is how each line of the file looks like, different date and time in this format Sun Aug 19 08:33:45 EDT 2012, user1( all: test on the 17th ... (2 Replies)
Discussion started by: bkkid
2 Replies

9. Shell Programming and Scripting

python - wget xml doc and parse with awk

Well, that's what I'd do in bash :) Here's what I have so far: import urllib2 from BeautifulSoup import BeautifulStoneSoup xml = urllib2.urlopen('') soup = BeautifulStoneSoup(xml) print soup.prettify() but all it does is grab the html... (0 Replies)
Discussion started by: unclecameron
0 Replies

10. UNIX for Dummies Questions & Answers

Creating a one liner with wget, grep and mv

I have the following simplified script, that consists of a download (wget), a grab of only the lines with a comma (grep) and a rename of the file to indicate its date of origin (mv): wget grep ',' datafile.csv mv datafile.csv datafile.`date... (2 Replies)
Discussion started by: figaro
2 Replies

Featured Tech Videos