Tag Info

New answers tagged


If you want UTF-8 encodings of code points 0 to 0x7FFFFFFF (which the UTF-8 encoding algorithm was originally designed to work on): < /dev/urandom perl -CO -ne ' BEGIN{$/=\4} no warnings "utf8"; print chr(unpack("L>",$_) & 0x7fffffff)' Nowadays, Unicode is restricted to 0..D7FF, E000..10FFFF (though some of those characters are not ...


If you want non-ASCII characters, then you'll need a way to build valid UTF-8 sequences. The chance that two consecutive bytes yielding a valid UTF-8 is very low. Instead, this Python script creates random 8 bit values that can be converted in Unicode chars, then written out as UTF-8: import random import io char_count = 0 with io.open("random-utf8.txt", ...


The most efficient way to create a text file with size 10 MB and UTF-8 character encoding is base64 /dev/urandom | head -c 10000000 | egrep -ao "\w" | tr -d '\n' > file10MB.txt


Grep for ASCII (sub-set of UTF-8) chars, on Linux/GNU: dd if=/dev/random bs=1 count=1G | egrep -ao "\w" | tr -d '\n'


Found the solution here awk without printing newline. The ORS (output record separator) variable in AWK defaults to "\n" and is printed after every line.


Use output redirection to capture standard output of your script to e. g. /path/to/output.log: /path/to/the/script.py > /path/to/output.log


You need to check whether $1 is in arr and if so whether the value is different from $2 and then print: awk -F, 'FNR == NR { arr[$1] = $3; next } { if ($1 in arr && arr[$1] != $2) print $2 }' Using FNR == NR and next is the conventional way to process lines in the first file differently from the lines in other files. Yes, you can flatten ...

Top 50 recent answers are included