Deleting a numeric sequence


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Deleting a numeric sequence
# 1  
Old 01-07-2013
Question Deleting a numeric sequence

I have a sequence which looks like this:

Code:
>string20525 107143
AWEELWKEKEGEHRWDDEDWDWQWJKIDDDDFDEFJERIJVJFBGNJGTHGFBLMFGLNHBFJTRJRSKWSNEJDDJIWWYSYAQQHQKSKDJKTIVVKTKBVKBKBKVKFKKK
>string1870 398197
GFFTHHHHHHHYHYBSKWWOSKWSKWKSKWKSKDFVPVPVBKHKKWKQAUQAUXFVMBHNNCOCECDISIIQAIANMQNQSYYEEYTRTQQZVBNMMMSDSRTYUQOEUE
sstring18800 1181
HHHHHHRYWQA
>string1880 397224
GTGTGTGGHQQWWSS
>string18900 1175
GTGTJWQGJIMNFF
>string1890 395606
HYHEWQSSFH

I want to some how delete the 2nd value ie the 2nd tab value(the values of107143, 398197,1081 and so on..). I want it to look like this:
Code:
>string20525 
AWEELWKEKEGEHRWDDEDWDWQWJKIDDDDFDEFJERIJVJFBGNJGTHGFBLMFGLNHBFJTRJRSKWSNEJDDJIWWYSYAQQHQKSKDJKTIVVKTKBVKBKBKVKFKKK
>string1870 
GFFTHHHHHHHYHYBSKWWOSKWSKWKSKWKSKDFVPVPVBKHKKWKQAUQAUXFVMBHNNCOCECDISIIQAIANMQNQSYYEEYTRTQQZVBNMMMSDSRTYUQOEUE
>string18800
HHHHHHRYWQA
>string1880 
GTGTGTGGHQQWWSS
>string18900
GTGTJWQGJIMNFF
>string1890 
HYHEWQSSFH

is there a way i can delete the numbers following stringXXXXX ??


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by radoulov; 01-07-2013 at 04:58 PM..
# 2  
Old 01-07-2013
Code:
awk '/string[0-9]/{$2="";}1' file

This User Gave Thanks to Yoda For This Post:
# 3  
Old 01-07-2013
Code:
awk '/^>string/ {$0=$1}1' myFile

This User Gave Thanks to vgersh99 For This Post:
# 4  
Old 01-07-2013
thankyou all it worked!!! Smilie Smilie
# 5  
Old 01-07-2013
vgersh99, I see there is one line which is not starting with >string hence I didn't use '/^>string/
Code:
GFFTHHHHHHHYHYBSKWWOSKWSKWKSKWKSKDFVPVPVBKHKKWKQAUQAUXFVMBHNNCOCECDISIIQAIANMQNQSYYEEYTRTQQZVBNMMMSDSRTYUQOEUE
sstring18800 1181
HHHHHHRYWQA
>string1880 397224

EDIT: vgersh99, I'm sorry, your solution is good (it was a typo from requester)

Last edited by Yoda; 01-07-2013 at 05:17 PM.. Reason: Correction
This User Gave Thanks to Yoda For This Post:
# 6  
Old 01-07-2013
yaa it was a typo error from my side..
This User Gave Thanks to sonia102 For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting a pattern in UNIX without deleting the entire line

Hi I have a file: r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e) I want to retain... (15 Replies)
Discussion started by: Alyaa
15 Replies

2. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

3. Shell Programming and Scripting

Help with numeric manupulations

I want to calculate the following expression in script: val=179584.0 ($val *3*16384)/(1073741824) $val will have a floating value. Thanks! I tried with following: n=$(echo |awk '{ print $val*3*16384 }') n=$(echo |awk '{ v=$val; print $v*3*16384 }') expr $val \* 3.0 \*... (10 Replies)
Discussion started by: karumudi7
10 Replies

4. Shell Programming and Scripting

How to check for a Numeric Value?

Using shell, I have a variable, how can I check that variable for a numeric value such as "41.0"? My program needs to do one things if the numeric value is found, and another if something else such as a string of letter is found. is there a specific character that denotes a numeral? The... (2 Replies)
Discussion started by: chagan02
2 Replies

5. UNIX for Dummies Questions & Answers

Find and Replace random numeric value with non-numeric value

Can someone tell me how to change the first column in a very large 17k line file from a random 10 digit numeric value to a non numeric value. The format of lines in the file is: 1702938475,SNU022,201004 the first 10 numbers always begin with 170 (6 Replies)
Discussion started by: Bahf1s
6 Replies

6. Shell Programming and Scripting

Numeric or not?

Is there an easy way using a command or other routine for testing whether an argument on the command line is numeric? Just want to validate... I ran a search and didn't find a similar question.... Thx (3 Replies)
Discussion started by: harrisjl
3 Replies

7. Shell Programming and Scripting

Numeric or not

Is there a simple way of determining whether a command line arguement is numeric or not?? I tried a search and didn't find anything similar... This is the 2nd time I've made this post.... It didn't appear that the first one showed up ?? Sorry if this is a duplicate... (1 Reply)
Discussion started by: harrisjl
1 Replies

8. Shell Programming and Scripting

Numeric Validation

Hi, How to check whether an input to a shell script contain only numeric values. Is there any way to check against the following characters. & ( ) | \ " ' < > ` I've used the following way. echo $1 | grep "\{2\}$" if then (12 Replies)
Discussion started by: sumesh.abraham
12 Replies

9. Shell Programming and Scripting

Perl code to differentiate numeric and non-numeric input

Hi All, Is there any code in Perl which can differentiate between numeric and non-numeric input? (11 Replies)
Discussion started by: Raynon
11 Replies

10. Shell Programming and Scripting

Checking numeric value

Hi, How can I check numeric value in shell? I am passing one parameter (integer) and I want to restrict any other characters except 0-9. ./script xyz 10 Here 2nd parameter (10) should be integer only. Can anyone help on this? Malay (6 Replies)
Discussion started by: malaymaru
6 Replies
Login or Register to Ask a Question