Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Delete specific strings in a file Post 302931125 by senhia83 on Saturday 10th of January 2015 08:41:43 PM
Old 01-10-2015
Try

Code:
 
 $ cat  tmp
 >C4603985
 ATGFFGTGFAGGHTGHTAHGHATAGGTHTTHAHAGHGCHATCACCTGCGATATGGGGGCCACCATAGATAGTAAAGATGGTTCTTACCFAGATGFFGTGFAGGHTGHTAHGHATAGGTFAGATGFFGTGFAGGHTGHTAHGHATAGGTFAGATGFFGTGFAGGHTGH>C3914137
 CATCTTGFFGTGFAGGHTGHTAHGHATAGGTHTTHAHAGHGCHTTATTAGGGAAGAAACCTTCATTCTCTTTTTAATTTTCTTTTTCAAGATGCAATTGFFGTGFAGGHTGHTAHGHATAGGTHTTHAHAGHGCHCTGTATCACCAGTTATATATAGATTGCATCTTGATATAGATATAGTG
 >stt4468869
 SQAERTYUVSAASSFFAGATGFFGTGFAGGHTGHTAHGHATAGGTHTTHAHAGHGCHAHAHGHACTHTGHTGGHCAHAANGGGATATAACCAGGTGGAAGGTAGACTACTTTGATAGTTTTTCTCCAGTNGNGCANAAGTTAGTAACAGTGAGAATTTTCTTAGCAATCGCAG
 >C4913369
 GTERTYUVSAASSFFAGATGFFGTGFAGGHTGHTAHGHATAGGTTGCVTCABGCGBATBAAGATBTBTHYHBHHTAGCGCCCTACGTACGATGCAGTAAATTCCGTAACGTAGTGGTTGAGATATCTCAGTAAGCTTCACGTTGACGTTAGTTBTBTAATCGCCCGTGATGDDDGTGTTAGAATGTTTAAAGGATATACAT
 >stt4688097
 GCDDDDCJJJJAWDDDDFFFFFCTCATATCGCAGGTGATTCCAACAGATCGCATGAGAGGTATGTCCGAGAGGCAAATCATTCTTTTCGGCTCTATGGATCCGAAGGACCTGCGAAAAGGGCAAAACCGACCTCGGACGAGATTGTGTTTACGGACGAGCATGAGAGGTATGTCCGAGAGGCAAATCATTCTTTTCGGCTCTATGGATCCGAAG
  
 $ awk '{ if ( $0~/>st/ ) {
 > a=1
 > }
 > if ( $0 ~/>C/ ) {
 > a=0}
 > if ( a==1)
 > print $0
 > }' tmp
 >stt4468869
 SQAERTYUVSAASSFFAGATGFFGTGFAGGHTGHTAHGHATAGGTHTTHAHAGHGCHAHAHGHACTHTGHTGGHCAHAANGGGATATAACCAGGTGGAAGGTAGACTACTTTGATAGTTTTTCTCCAGTNGNGCANAAGTTAGTAACAGTGAGAATTTTCTTAGCAATCGCAG
 >stt4688097
 GCDDDDCJJJJAWDDDDFFFFFCTCATATCGCAGGTGATTCCAACAGATCGCATGAGAGGTATGTCCGAGAGGCAAATCATTCTTTTCGGCTCTATGGATCCGAAGGACCTGCGAAAAGGGCAAAACCGACCTCGGACGAGATTGTGTTTACGGACGAGCATGAGAGGTATGTCCGAGAGGCAAATCATTCTTTTCGGCTCTATGGATCCGAAG

This User Gave Thanks to senhia83 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete strings in a file

Hi, I have a file named status.txt that looks like the file below. What I want to do is to delete the part <status> and </status> and just leave the number and print each number per line. How can I do it? If I will use sed or awk how can I do it? I tried with sed but it didn't work. Maybe I... (8 Replies)
Discussion started by: ayhanne
8 Replies

2. Shell Programming and Scripting

delete strings till specific string

Hello i want to know a way so i can delete all the strings in file from the begning till a specific string (1 Reply)
Discussion started by: modcan
1 Replies

3. Shell Programming and Scripting

recursively delete the text between 2 strings from a file

i have 200000bytes size of a unix file i need to delete some text between two strings recursively using a loop with sed or awk . these two strings are : 1st string getting from a file :::2 nd string is fi...its constant . can anyone help me sed -n'/<1 st string >/,/fi/' <input_filename> is the... (2 Replies)
Discussion started by: santosh1234
2 Replies

4. Shell Programming and Scripting

Delete Strings that are present in another file

HI, if a String is present in file1.txt, i want to delete that String from file2.txt. How can i do this?? I am sure that the file1.txt is a subset of file2.txt. (2 Replies)
Discussion started by: jathin12
2 Replies

5. UNIX for Dummies Questions & Answers

Delete strings in file1 based on the list of strings in file2

Hello guys, should be a very easy questn for you: I need to delete strings in file1 based on the list of strings in file2. like file2: word1_word2_ word3_word5_ word3_word4_ word6_word7_ file1: word1_word2_otherwords..,word3_word5_others... (7 Replies)
Discussion started by: roussine
7 Replies

6. Shell Programming and Scripting

output strings to specific positions in a file

Been searching for about 3 hours for similar functionality that I can get examples of how to output text from variables into certain locations in a file. I would like to incorporate this into a script. I have not been able to find a command example that does it all in one method. I find part of... (1 Reply)
Discussion started by: bennu_500
1 Replies

7. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

8. UNIX for Dummies Questions & Answers

Add strings from one file at the end of specific lines in text file

Hello All, this is my first post so I don't know if I am doing this right. I would like to append entries from a series of strings (contained in a text file) consecutively at the end of specifically labeled lines in another file. As an example: - the file that contains the values to be... (3 Replies)
Discussion started by: gus74
3 Replies

9. Shell Programming and Scripting

How to delete strings in a file?

hi, i have a big file like this: >s31 length=12 numreads=6 gene=isotig454 status=igo ldfddfdfdfdkkkkkkfdfdkkkksdfdkkkkkkkkkksdfd dfdfdfldfdkdffdlfddflfdjkkkkkkfdgkkgfhghfgkkk ldfddfdfdfdkkkkkkfdfdkkkksdfdkkkkkkkkkksdfd dfdfdfldfdkdffdlfddflfdjkkkkkkfdgkkgfhghfgkkk >c2 length =344... (4 Replies)
Discussion started by: the_simpsons
4 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
SQUIZZ(1)							   User Manuals 							 SQUIZZ(1)

NAME
squizz - Sequence format checker SYNOPSIS
squizz [-AShlns] [-c format] [-f format] file OPTIONS
Following command line options are allowed: -A Restrict detection/verification to alignment formats (conflict with -S option). -S Restrict detection/verification to sequence formats (conflict with -A option). -c format Convert detected sequence/alignment into format. This option implies strict alignment checking. -f format Assume input format is format. Do not try to detect the format, just verify that the given one is correct. -h Usage display. -l List all supported formats. -n Count and report detected entries. This option is only available when the detection is restricted to a single type (with -A or -S options) and strict checks (without -s option) are enabled. -s Disable strict format checks (enabled by default). DESCRIPTION
squizz is a sequence format file checker, but it has some conversion capabilities too. squizz can detect the most common sequence and alignment formats : * EMBL, FASTA, GCG, GDE, GENBANK, IG, NBRF, PIR (codata), RAW, and SWISSPROT. * CLUSTAL, FASTA, MSF, NEXUS, PHYLIP (interleaved and sequential) and STOCKHOLM. squizz can do some conversions too, if the format the input format is supported. Only 3 types are available : sequence to sequence, align- ment to alignment, and alignment to sequence (the last one, sequence to alignment, require multiple alignments algorithms and cannot be handled with formatting tools). Strict format checks validate the previously detected objects, by making some sanity checks: - sequence strings must exists. - alignment is made of more than one sequence. - alignment sequence strings must have the same length. - alignment sequence names must exists, and be unique. SEE ALSO
seqfmt(5), alifmt(5) AUTHOR
Nicolas Joly (njoly@pasteur.fr), Institut Pasteur. Unix 2009-05-19 SQUIZZ(1)
All times are GMT -4. The time now is 06:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy