Results for "Perloneliner"

Wire posts

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

    3910 days ago

  • To print the matching pattern line perl -ne '/pattern/ && print' infile.gtf #Perloneliner #Tipsoftheday

    3858 days ago

  • perl -nle '$count += () = /XY[0-9]+/g; END {print $count}' inputfile #Count #Perl #Perloneliner

    3636 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

    3605 days ago

  • Search and replace the string 'this' with the string 'that' in the file filename. perl -p -i -e 's/this/that/g' filename #Perl #Trick #PerlOneLiner #Tipsoftheday #Replace #FindandReplace

    3152 days ago

  • Delete space from FASTA header: perl -pe 's/>\S+\K.+//' < file.fasta > new_file.fasta #PerlOneLiner #Trick #Perl #Space #Fasta

    2968 days ago

  • Replace space with tab: perl -lpe 's/\s/\t/g' < trf_file.dat > outfile.txt #TRF #Tab #Space #Replace #Perl #PerlTrick #PerlOneliner

    2819 days ago

  • Rename the fasta name perl -ane 'if(/\>/){$a++; @foo = split /\s+/;$_ = join '_', @foo; print "$_\n"}else{print;}' your.fasta > new.fa #PerlTrick #PerlOneliner #Perl

    2778 days ago

  • Extract fasta sequence by Ids: perl -ne 'if(/^>(\S+)/){$c=grep{/^$1$/}qw(id1 id2)}print if $c' fasta.file #Perl #PerlOneliner #PerlTrick #Extract #Ids #Fasta

    2777 days ago

  • Extract sequence by using Ids file (assuming one ids in a line): perl -ne 'if(/^>(\S+)/){$c=$i{$1}}$c?print:chomp;$i{$_}=1 if @ARGV' ids.file fasta.file #PerlTricks #PerlOneliner #Perl #Extract #Ids #

    2777 days ago