Archive for October, 2009
My first production C program…
Friday, October 30th, 2009Took the class like six years ago but never had a need to actually put any code in production best I can remember. Shell was taking, at best I could optimize it, 13 hours to create the files I needed…with C I can do it in a about 5 minutes. Wow. It’s a really simple [...]
Random ranging…
Friday, October 30th, 2009This was an attempt to provide random urls to http_load, which didn’t work since http_load just reads the file once. Looks like I may have delve into C and implement the randomness in http_load itself. But I like the code. It takes the square root of the highest possible number in the file name to [...]
Finding total number of lines in multiple files
Thursday, October 29th, 2009find ./ -name “http_load_urls_*” -print0 | xargs -0 wc -l
Yet another one line shell script :)
Monday, October 26th, 2009grep -R ‘>1254511748.80104′ * | awk -F: ‘{print $1}’ > filename; filename=$(head -1 filename); grep -n ‘%idle’ $filename | awk -F: ‘{print $1 + 13}’ > linenum; sed -i ‘s/^/head -/g’ linenum; sedfilename=$(head -1 filename | sed ‘s/\//\\\//g’); sed -i “s/$/ $sedfilename | tail -1 /g” linenum; chmod 755 linenum; ./linenum | sed ‘s/^.*”>//g’ | [...]
Now that’s a one liner…
Wednesday, October 21st, 2009grep -R -n ‘pgpgin/s’ * | grep ‘:16′ | awk -F: ‘{printf “file=”$1″\n pagein=$(head -”$2 + 12″ “$1″ |\ tail -1 | sed \”s/^.*Number\\\”\>//g\” | sed \”s/\<.*$//g\”) \n echo \$file \t \$pagein \n”}’ \ > pagein.bash; ./pagein.bash > page_in.txt; sed -i ‘s/.xml//g’ page_in.txt; sed -i ‘s/K_.*_/K /g’ \ page_in.txt; sed -i ‘s/M_.*_/M /g’ page_in.txt; sed [...]
Another cool little line…
Monday, October 5th, 2009While creating a bunch of files, counts them and subtracts our fixed starting count: var=$(ls /raid | grep -c .) ; echo “$var – 192000″ | bc