{"id":7,"date":"2005-12-06T01:30:32","date_gmt":"2005-12-06T06:30:32","guid":{"rendered":"http:\/\/raffy.ch\/blog\/?p=7"},"modified":"2005-12-06T02:54:43","modified_gmt":"2005-12-06T07:54:43","slug":"adding-random-things","status":"publish","type":"post","link":"https:\/\/raffy.ch\/blog\/2005\/12\/06\/adding-random-things\/","title":{"rendered":"Adding Random Data To Files"},"content":{"rendered":"<p>I find myself adding data to files that need to be randomized. Well, just call awk from within vi and use the rand() function<\/p>\n<p>:%!awk &#8216;BEGIN {srand()}; {if (int(rand()*4)==2) {printf(&#8220;\\%s,S\\n&#8221;,$0)} else print $0;}&#8217; <\/p>\n<p>Maybe even a bit more comfortable AND this only adds to the lines if they don&#8217;t use SA, S or F<\/p>\n<p>:%!awk &#8216;BEGIN {srand()} \\!\/(SA|S|F)$\/ {if (int(rand()*4)==2) {sub(\/$\/,&#8221;FA&#8221;);}};{print}&#8217; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I find myself adding data to files that need to be randomized. Well, just call awk from within vi and use the rand() function :%!awk &#8216;BEGIN {srand()}; {if (int(rand()*4)==2) {printf(&#8220;\\%s,S\\n&#8221;,$0)} else print $0;}&#8217; Maybe even a bit more comfortable AND this only adds to the lines if they don&#8217;t use SA, S or F :%!awk [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-vi"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":0,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"wp:attachment":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}