head -n 100 filename.txt > smallfile.txt
tail -n 100 filename.txt > smallfile.txt
sed -n '100,200p;200q' filename.txt > smallfile.txt
grep -m 100 'text_to_search' filename.txt > smallfile.txt
Instead of echo text > smallfile.txt, you can avoid the temporary file and go right to vim with:
echo text | vim -