User Tools

Site Tools


unix_shell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
unix_shell [2022/02/18 17:17] 38.20.199.40unix_shell [2022/06/23 10:21] (current) 134.190.232.106
Line 1: Line 1:
-upcoming+The commonly used scripts collected from previous Github page and course materials.
  
-Here's a list of commands to retrieve deleted text in vi:+1.How to set up timer for specific script run? 
 + 
 +<code> 
 +#!/bin/bash 
 +# Twosday.sh 
 + 
 +while true; 
 +do 
 +    DATE=`date | cut -d' ' -f4` 
 +    #echo $DATE 
 +    if [[ $DATE == "22:22:22" ]] 
 +    then 
 +            echo "this is a test program" >> xyz.log 
 +            qrsh 
 +            sleep 1s 
 +    fi 
 +done 
 +</code> 
 + 
 +<code> 
 +#stopwatch 
 +#https://superuser.com/questions/611538/is-there-a-way-to-display-a-countdown-or-stopwatch-timer-in-a-terminal 
 +while true; do echo -ne "`date`\r"; done 
 +#nanoseconds: 
 +while true; do echo -ne "`date +%H:%M:%S:%N`\r"; done 
 +</code> 
 + 
 + 
 +2.Here's a list of commands to retrieve deleted text in vi:
  
 <code> <code>
Line 76: Line 104:
  
 <code> <code>
->cd /scratch2/xizhang/ +https://github.com/brentp/pyfasta 
-/home/xizhang/.local/bin/pyfasta split -n 6 original.fasta+# To install python2 version 
 +pip install pyfasta 
 +# To install python3 version 
 +pip3 install pyfasta 
 + 
 +#split a fasta file into 6 new files of relatively even size: 
 +pyfasta split -n 6 original.fasta
 </code> </code>
  
 Rename file name with the one user wanted https://linuxgazette.net/18/bash.html Rename file name with the one user wanted https://linuxgazette.net/18/bash.html
 +https://unix.stackexchange.com/questions/580506/renaming-multiple-files-using-a-loop
 <code> <code>
  
 +for i in *; do -- mv "$i" "${i/%.fasta/.fa}"; done
 +for f in *; do mv "$f" "${f#*_}";done
  
 for i in chr* for i in chr*
Line 104: Line 141:
 </code> </code>
  
-<Last updated by Xi Zhang on Oct 6th,2021>+ 
 +How to use sort in linux, especially ignore the header to sort special col? 
 +<code> 
 +(head -n 1 all.txt && tail -n +2 all.txt| sort -n -r -k2) > 123.txt 
 + 
 +# sort -n 
 +#sort -r 
 +#sort -k 
 +https://shapeshed.com/unix-sort/; https://stackoverflow.com/questions/14562423/is-there-a-way-to-ignore-header-lines-in-a-unix-sort 
 +</code> 
 + 
 +<Last updated by Xi Zhang on Oct 6th,2021> <June 23th,2022>
unix_shell.1645219075.txt.gz · Last modified: by 38.20.199.40