Shell scripting : pls help me


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell scripting : pls help me
# 1  
Old 10-06-2010
Network Shell scripting : pls help me

I have an input file in this format (shown below). I have to select the lines which doesnt followed by 'miR-" and to save such lines into an output file. For easy identification they are shown here in blue color. They have to be selected. Pls. help me to write a shell script to select those lines which doesnt followed by miR- and have to write them in a file.
KINDLY DO THE HELP

>sample1:1:1:1056:8164#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1057:7503#0 0 0
>sample1:1:1:1057:18666#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1057:1725#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1057:12664#0 0 0
>sample1:1:1:1057:18537#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1058:8130#0 1 1
miR-2396;Chr26:42482649-42482717 -1 2
>sample1:1:1:1058:19619#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1059:6357#0 0 0
>sample1:1:1:1059:10418#0 0 0

>sample1:1:1:1059:12084#0 1 1
miR-16-1;Chr12:19596200-19596290 -52 2
>sample1:1:1:1060:13498#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1060:11510#0 0 0
>sample1:1:1:1060:2691#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1060:5177#0 0 0
>sample1:1:1:1060:13599#0 1 1
miR-16-1;Chr12:19596200-19596290 -52 2
>sample1:1:1:1060:12022#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1061:8105#0 0 0
>sample1:1:1:1062:4635#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1062:2052#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1062:17129#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1063:6105#0 0 0
>sample1:1:1:1064:11266#0 0 0

>sample1:1:1:1065:5224#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1065:14605#0 1 1
miR-152;Chr19:39081165-39081250 +53 2
>sample1:1:1:1066:5654#0 0 0
>sample1:1:1:1066:10310#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1067:3521#0 1 1
miR-184;Chr21:25913771-25913853 +52 2
>sample1:1:1:1067:1055#0 1 1
# 2  
Old 10-06-2010
You posted the input data, but it would be kind to post us the expected result/output.

Regards
# 3  
Old 10-06-2010
Quote:
Originally Posted by hravisankar
I have to read a file- line by line using shell script. the format should be exactly same as given below

Chr18:4000-4010
Chr20:393939-400303
Chr30:38838-30020

I already posted a thread and 2 answers did not read the data like that. ...
That's because your problem statement is quite vague. A "read" operation does not "have" a format, which is why "read" cannot "be" in any format.

Your input data in a file or from a pipe "has" or "is in" some particular format. So, I'll assume that this -

Code:
Chr18:4000-4010
Chr20:393939-400303
Chr30:38838-30020

is the format of your input data. Again, I'll assume that this data is in a file, as opposed to a pipe stream.

In the shell, you'd read a file like so -

Code:
$
$ # display the content of the file. My file is called "f32", yours may be different.
$ cat f32
Chr18:4000-4010
Chr20:393939-400303
Chr30:38838-30020
$
$ # read data from input file "f32"
$ while read LINE; do   echo "Oh my! I've now read this line => $LINE"; done < f32
Oh my! I've now read this line => Chr18:4000-4010
Oh my! I've now read this line => Chr20:393939-400303
Oh my! I've now read this line => Chr30:38838-30020
$
$

HTH,
tyler_durden
# 4  
Old 10-07-2010
Shell scripting problem

My input file (data1) is like this
Chr8:4000-4500
Chr10:4000-4600

I written a shell program like this.
while read LINE;
do echo "$LINE";
samtools faidx Bos_taurusUMD3.fa "$line";
done < data1


It has to read a line like Chr8:4000-4500 from input file and that line has to be executed in a command like 'samtools faidx Bos_taurusUMD3.fa Chr8:4000-4500'. Then I will get the sequence like this.
>Chr8:4000-4500
TAATTCGTTTTTCTTTTTTCCTCTCTGACTCATTTATTTGTACCATTCTATCTTCTAATT
CACTAATCTTATCTTCTGCCTCTGTTATTCTACTATTTGTCGCCTCCAGAGTGTTTTTGA
TCTCATTTATTGCATTATTCATTATATATTGACTCTTTTTTATGTCTTCTAGGTCCTTGT
TAAACCTTTCTTGCATCTTCTCAATCCTTGTCTCCAGGTTATTTATCTGTGATTCCATTT
TGATTTCAAGATTTTGGATCAATTTCACTATCATTATTCAGAATTCTTTATCAGGTAGAT
TCCTTATCTCTTCCTCTTTTGTTTTGTTTGGTGGGCATTTATCCTGTTCCTTTACCTGCT
GGGTATTCCTCTGTCTCTTCATCTTGTTTATATTGCTGAGTTTGGGGTGTCCTTTCTGTA
TTCTGGCAGTTTGTGGAGTTCTCTTTATTGTGGAGTTTCCTCGCTGTGTATGGGTTTGTA
CAGGTGGCTTGTCAAGGTTTC

but when I execute the shell it is displaying the output like this

Chr8:4000-4500
>
Chr10:4000-4600
>
but not displaying the sequence.but I execute the command at $ prompt like
$samtools faidx Bos_taurusUMD3.fa Chr8:4000-4500
it is running and displaying the sequence.

How to execute it in my shell by reading each line from input line, execute it in command and display the sequences.
KINDLY HELP ME
# 5  
Old 10-07-2010
try like this
Code:
samtools faidx Bos_taurusUMD3.fa "$line"

# 6  
Old 10-07-2010
Reading input line problem

Thank u very much for your reply. I used as u specified "$line" in samtools command like samtools faidx Bos_taurusUMD3.fa "$line";

It is giving out like this. Sequence was not given. it displays it as > only.

Chr8:86884850-86884997
>
ChrX:96383583-96383703
>
Chr15:33347613-33347720
>
~
Kindly help me how to execute that to generate the sequence.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help with first shell script pls.

Hi, I'm trying to extract information from one file to update another one and am a bit stuck. the first file is made up of tags e.g. <item>a@b.com</item> jksdhfjkdsh sldkjfds l klsjdf <item> c@d.com </item> what i'd like to do is extract the email addresses between these tags,... (6 Replies)
Discussion started by: newb1000
6 Replies

2. Shell Programming and Scripting

Shell program help pls

first queestion if what does "-s" mean? second seqx -n 10000000 -c 10 < $seqfile >$temp seqx? -n? -c? what do these mean? third if && ! cmp -s $missing $temp explain these codes ty (2 Replies)
Discussion started by: imtheone
2 Replies

3. Shell Programming and Scripting

scripting/awk help : awk sum output is not comming in regular format. Pls advise.

Hi Experts, I am adding a column of numbers with awk , however not getting correct output: # awk '{sum+=$1} END {print sum}' datafile 2.15291e+06 How can I getthe output like : 2152910 Thank you.. # awk '{sum+=$1} END {print sum}' datafile 2.15079e+06 (3 Replies)
Discussion started by: rveri
3 Replies

4. Shell Programming and Scripting

shell script, pls help

# for i in `cat oo`;do ls -ld $i;done ls: /var/tmp/i: No such file or directory ls: i: No such file or directory ls: /var/tmp/ii: No such file or directory ls: i: No such file or directory ls: /var/tmp/iii: No such file or directory ls: i: No such file or directory ls: /var/tmp/iiii: No such... (2 Replies)
Discussion started by: cpttak
2 Replies

5. UNIX for Advanced & Expert Users

pls help me in scripting

i want to write a script that if the time is 8 then it give a message that the time is 8 and if it is 9-10 then it gives a message that time to go to office like that. can any one help me? (3 Replies)
Discussion started by: lakshmananindia
3 Replies

6. Shell Programming and Scripting

hi..all..pls...help..!!..profile scripting..

hi.. I want to customize a user in unix which could have only ftp access and NO TELNET ACCESS! ..... As being a newbie to unix to my understanding the user .profile has to be edited but if someone can explain how to edit it so that i can block telnet access for that user.....Is /etc/profile has... (5 Replies)
Discussion started by: rookie250
5 Replies

7. Shell Programming and Scripting

HELP PLS!! Shell Scripting!!

Dear All, forgive me as i am a complete beginner in shell scripting in UNIX. I have a file with data similair to the following 8 McDonalds Sandwich 1.99 9 Mcdonalds Fries 1.20 13 McDonalds Milkshake 1.20 7 ... (9 Replies)
Discussion started by: Mary_xxx
9 Replies

8. Shell Programming and Scripting

HELP me PLS... Simple Scripting!

this is my script.... SQL> select * from dba_profiles 2 where resource_name in ('FAILED_LOGIN_ATTEMPTS','PASSWORD_LOCK_TIME') 3 order by profile; and this is the output... PROFILE RESOURCE_NAME RESOURCE... (2 Replies)
Discussion started by: liezer
2 Replies

9. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

10. Shell Programming and Scripting

scripting guru's pls help me with scripting on AIX

can someone pls help me with the script for a files coming from one system to a particular directory and i want to write a script to move those files to another directory on different system by renaming the files... pls someone help me on this... thanking in anticipation.... (1 Reply)
Discussion started by: thatiprashant
1 Replies
Login or Register to Ask a Question