Skip to content

Instantly share code, notes, and snippets.

@elhenro
Created June 24, 2023 10:27
Show Gist options
  • Save elhenro/ed355713e824d402ab1618dddbe0ef12 to your computer and use it in GitHub Desktop.
Save elhenro/ed355713e824d402ab1618dddbe0ef12 to your computer and use it in GitHub Desktop.
#!/bin/bash
OUTPUTFILE="data.txt"
find . -type f -not -path "./node_modules/*" | while read -r file
do
numlines=$(wc -l < "$file")
if [[ $numlines -lt 1000 ]]; then
fileext="${file##*.}"
echo -e "\n$file\n" >> $OUTPUTFILE
echo -e "\n\`\`\`$fileext\n" >> $OUTPUTFILE
cat "$file" >> $OUTPUTFILE
echo -e "\n\`\`\`\n" >> $OUTPUTFILE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment