Results for "PerlOneLiner"

Tags

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

    Tags: Tipsoftheday, Perloneliner

    3883 days ago

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

    Tags: Perloneliner, Tipsoftheday

    3831 days ago

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

    Tags: Count, Perl, Perloneliner

    3609 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

    Tags: Perl, Perloneliner, Count, Occurrence

    3578 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

    Tags: Perl, Trick, PerlOneLiner, Tipsoftheday, Replace, FindandReplace

    3125 days ago

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

    Tags: PerlOneLiner, Trick, Perl, Space, Fasta

    2941 days ago

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

    Tags: TRF, Tab, Space, Replace, Perl, PerlTrick, PerlOneliner

    2792 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 #

    Tags: PerlTricks, PerlOneliner, Perl, Extract, Ids

    2750 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

    Tags: PerlTrick, PerlOneliner, Perl

    2751 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

    Tags: Perl, PerlOneliner, PerlTrick, Extract, Ids, Fasta

    2750 days ago