Skip to content

Instantly share code, notes, and snippets.

@mdyzma
Last active October 22, 2015 21:37
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 mdyzma/889db60b68d1627ce487 to your computer and use it in GitHub Desktop.
Save mdyzma/889db60b68d1627ce487 to your computer and use it in GitHub Desktop.
# Biosnips to store some good oneliners and linux tricks
# to perform much more efficiently
# Michal Dyzma 2015
# Creating automaticly folders with actual date
# set alias in .bashrc
alias "today"="date +%F"
# type in console
mkdir foo-$(today)
#==================
# Create multiple files and folders
#folders
mkdir -p tutorial/{content/chapter-{1..8}/{data,img},docs,styles,utilities}
#files
touch sekwencje/prot{A,B,C}_R{1,2}.fastq
#==================
# line will find differences in 2 text files and first pipe will throw +/- at front of each line
# (same or different), #second pipe will get all different lines (-) and put them to separate
# out.txt file.
diff -u file1 file2 | sed -n '1,2d;/^[-+]/p' | grep '^-' > out.txt
#==================
#oneliner replacing tabs with comas generating csv file
sed 's/\t/','/g' < input > output
#==================
#alternative replacicng spaces with comas
sed 's/' '/','/g' < input > output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment