Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am very new at bash, so forgive me for the novice question.

Here is my curl call:

curl -d 'username=cdaniels&wallclock=391324502' 'https://www-dev.***.***.edu/clusterusage/rest/update.html';

which pulls from a file ~/qacct.monthly with the format

Total    : OWNER         WALLCLOCK         UTIME         STIME           CPU             MEMORY                 IO                IOW
Total    : ==========================================================================================================================
Total    : cdaniels      391324502         0.195         0.066         0.261              0.000              0.007              0.000
Total    : jlinger               1         0.039         0.056         0.095              0.000              0.000              0.000
Total    : lbsome         18707336  18675574.761     21433.535  18697008.296       10604793.658           5527.986              0.000

The example only pulls one of the users, but I want it to parse through the information and pull all the usernames and wallclock information from all the users on the cluster for that month.

I'm wanting to put this into a script so that it executes every month (obviously through a cron job)

share|improve this question
I was thinking something like this: ~/qacct.monthly | awk '{print $3}''{print $4}' : which yields the username and wallclock information –  Jeff Mar 28 '12 at 14:54

1 Answer 1

up vote 2 down vote accepted

Something like the following should work:

while IFS= read -r data; do
    curl -d "${data}" 'https://www-dev.***.***.edu/clusterusage/rest/update.html'
done < <(awk 'NR>2 { print "username="$3"&wallclock="$4 }' users)
share|improve this answer
I keep getting an error: line 7: syntax error near unexpected token <' curl_sysadmin.sh: line 7: done < <(awk 'NR>2 { print "username=$3"&wallclock="$4 }' users)' –  Jeff Mar 29 '12 at 14:02
@Jeff - Sorry, wrong interpreter. –  Chris Down Mar 29 '12 at 17:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.