Skip to content

Instantly share code, notes, and snippets.

View behroozam's full-sized avatar
😁
teheeee

Behrouz Hasanbeygi behroozam

😁
teheeee
View GitHub Profile
@behroozam
behroozam / curl bash readline variable
Created July 23, 2017 13:07
read text file and call it with curl
while IFS= read -r line;do
fields=($(printf "%s" "$line"|cut -d' ' --output-delimiter=' ' -f1-))
echo "http://127.0.0.1:5000/services/rest/zzz/subscribe-withactor?mobilenum="${fields[1]}"&service_id="${fields[2]}"&shortcode="${fields[0]}"&message=&actor=MO;"
done < yourfile
@behroozam
behroozam / awk split huge file
Created July 23, 2017 13:03
how to split huge text file with awk flag
#when you have no space left on your server and your link is weak you hace no choice to remove or compress files . of course you can use awk in normal way but somtimes you log or text file contain messy things and its hard to select all pattern between start of file and end
# i use awk flag(on and off) but in normal timestamp(clear with no messy things) you can use split option to extract log
#!/bin/bash
awk '/2017-03-01/{flag=1}flag;/2017-04-01/{flag=0}' huge.log | gzip > 2017-03