Shangrila
Mind stream
Tuesday, July 05, 2011
BASH: Random text file sample (linewise)
num=$(wc -l < file.txt)
for i in $(seq 1 1000)
do
n=$(( $RANDOM * $RANDOM % $num ))
sed -n "${n}p" file.txt >> /tmp/file.txt.sample
done
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment