The problem is related to my answer here.
I cannot get the following code to work
#!/bin/bash wget http://www.google.com/coop/cse?cx=017685108214920485934%3Aizx6pzojwka -O CSE-spanien awk '/^searches [1-9]* sites, including:/ { print $2 }' CSE-spanien
Example of the Error message [edited]
$./code --2009-04-14 19:01:32-- http://www.google.com/coop/cse?cx=017685108214920485934%3Aizx6pzojwka Resolving www.google.com... 74.125.79.103, 74.125.79.99, 74.125.79.147, ... Connecting to www.google.com|74.125.79.103|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: `cse?cx=017685108214920485934:izx6pzojwka.6' [ <=> ] 8,096 --.-K/s in 0s 2009-04-14 19:01:33 (78.0 MB/s) - `cse?cx=017685108214920485934:izx6pzojwka.6' saved [8096] ./code: line 3: -O: command not found awk(57264) malloc: *** error for object 0x4eee0: Non-aligned pointer being freed (2) *** set a breakpoint in malloc_error_break to debug awk: cmd. line:1: fatal: cannot open file `/Users/Masi/Documents/test/CSE-spanien' for reading (No such file or directory)
How can you run AWK in a Bash script?
You’re missing
-O CSE-spanienat the end of yourwgetline. As a result,CSE-spaniendoesn’t exist –wgetis saving it the HTML with the filenamecse?cx=017685108214920485934:izx6pzojwka.2.