Results for "File"

Wire posts

  • Write something at the bottom of the file without opening it. perl -p -i -e 'eof && s/$/\nWord/;' <filename> #Tipsoftheday #Perloneliner

    3919 days ago

  • Number all lines in a file; perl -pe '$_ = "$. $_"': #Tipsoftheday #Perl

    3900 days ago

  • Count the total number of lines in a file. my $total=@{[<INFILE>]}; #Perl #Count #Number #Total #File

    3615 days ago

  • Convert space separated data to tab separated: perl -p -i -e 's/\s+/\t/g' file.txt #Perl #Tipsoftheday #Perlonliner

    3861 days ago

  • perl -nle 'if (/^>/) { $sl = 0; print; next } next if ($sl >= 200); $_ = substr($_, 0, 200-$sl) if ($sl + length($_) > 200); $sl += length($_); print;' file.fa >new.fa #Perl #Extract #Fasta

    3620 days ago

  • Remove N from a fasta file. Go to vi editor, type :%s/N\{25,\}//g and press enter. #Vim #vi #N #Replace #Fasta

    3620 days ago

  • Remove the blank space from a fasta file. perl -nlwe 'tr/ //d; print if length' fileName #Delete #Space #Fasta #Perl #Oneliner

    3620 days ago

  • Extract list of read ID from bam file: samtools view mbi.sorted.bam |perl -ne '/ID/ && print' > extractedID.sam #Extract #Ids #SAM #BAM #NGS

    3633 days ago

  • Count the contigs length in index fasta file with samtools. $ awk '{s+=$2}END{print s}' scaffolds.fasta.fai #Fasta #Index #Length #Count #Size #Samtools

    2142 days ago

  • Count the number of occurrence of pattern in a file using Perl. perl -e '$_ = <>; print scalar ( () = m/needle/g ), "\n"' #Perl #Perloneliner #Count #Occurrence

    3614 days ago