Skip to content

Instantly share code, notes, and snippets.

@kennyyu
Created September 20, 2013 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennyyu/6639714 to your computer and use it in GitHub Desktop.
Save kennyyu/6639714 to your computer and use it in GitHub Desktop.
edit N random files
#!/bin/bash
if [ -z "$1" ]
then
echo "usage: $0 N"
exit 1
fi
N=$1
files=$(find /home/passifist/linux-2.4.29 | grep "\.[ch]")
files=$(shuf --echo $files)
arr=($files)
sliced=("${arr[@]:0:$N}")
for file in "${sliced[@]}"
do
echo -e "\n// MY COOL EDITS" >> $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment