How can use the perl or other command line to calculate the length of the character?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How can use the perl or other command line to calculate the length of the character?
# 1  
Old 01-22-2009
How can use the perl or other command line to calculate the length of the character?

For example, if I have the file whose content are:
>HWI-EAS382_30FC7AAXX:7:1:927:1368
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>HWI-EAS382_30FC7AAXX:7:1:924:1373
ACGAACTTTAAAGCACCTCTTGGCTCGTATGCCGTC

I want my output calculate the total length of nucleotide. So my output should look like this:
>HWI-EAS382_30FC7AAXX:7:1:927:1368
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 36
>HWI-EAS382_30FC7AAXX:7:1:924:1373
ACGAACTTTAAAGCACCTCTTGGCTCGTATGCCGTC 36

Thanks for all of your advice. Have a nice day.
# 2  
Old 01-22-2009
You have the same thread with another subject already. Cross/double posting is forbidden by the rules; thread closed.

Continue here:
https://www.unix.com/shell-programmin...ould-type.html
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calculate the length of the each variable and matches to the desired value

My script is currently doing two function and I want to add one more as pre the question. echo -en "Enter the logmsg=" read logmsg logmsg1=${logmsg%%|*}; logmsg_len2=$(echo ${logmsg} | awk '{print $2}'); logmsg_suffix="|"; Char() { #echo $logmsg1 echo $logmsg1 | tr ',' '\n' | awk... (4 Replies)
Discussion started by: rohit22hamirpur
4 Replies

2. Shell Programming and Scripting

perl file, one line code include "length, rindex, substr", slow

Hi Everyone, # cat a.txt a;b;c;64O a;b;c;d;ee;f # cat a.pl #!/usr/bin/perl use strict; use warnings; my $tmp3 = ",,a,,b,,c,,d,,e,,f,,"; open(my $FA, "a.txt") or die "$!"; while(<$FA>) { chomp; my @tmp=split(/\;/, $_); if ( ($tmp =~ m/^(64O)/i) || ($tmp... (3 Replies)
Discussion started by: jimmy_y
3 Replies

3. Shell Programming and Scripting

How can I calculate the total of nucleotide in Unix?What command line I should type?

For example, if I have the file whose content are: >HWI-EAS382_30FC7AAXX:7:1:927:1368 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA >HWI-EAS382_30FC7AAXX:7:1:924:1373 ACGAACTTTAAAGCACCTCTTGGCTCGTATGCCGTC I want my output calculate the total of nucleotide. So my output should look like this:... (2 Replies)
Discussion started by: patrick chia
2 Replies

4. Solaris

Calculate the length and add some string infront

Hi all, I have file having 4 coulmn like 9246309198,406655682,400009246309198 9246309198,9246309198,400009246309198 9246309198,9246309198,400009246309198 9246309198,9246309198,400009246309198 9246309198,406655682,400009246309198 9246309198,9246309198,400009246309198 I want to valid... (4 Replies)
Discussion started by: salaathi
4 Replies

5. UNIX for Dummies Questions & Answers

what is the maximum length of th os-command line in Unix.

Hi All, I didn't find any thread that match this question so I hope it's not redundant. I am totally new to Unix. I want to know what is the maximum length of the os-commandline in Unix. Will it cause any problem if I run any application whose total path length is much longer than 256... (2 Replies)
Discussion started by: kumardesai
2 Replies

6. Shell Programming and Scripting

Building command line parameters of arbitrary length

I couldn't find an existing thread that addressed this question, so hopefully this isn't redundant with anything previously posted. Here goes: I am writing a C-Shell script that runs a program that takes an arbitrary number of parameters: myprog -a file1 \ -b file2 \ -c file3 ... \ -n... (2 Replies)
Discussion started by: cmcnorgan
2 Replies
Login or Register to Ask a Question