Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Delete specific strings in a file Post 302931135 by RavinderSingh13 on Sunday 11th of January 2015 12:52:33 AM
Old 01-11-2015
Hello sa@@,

One more approach may help you, very slightly different from Don's and Senhia83's script. Enjoy learning Smilie
Code:
awk '/^>stt/ {A=1} A{print} !/^>stt/ {A=0}' Input_file

Output will be as follows.
Code:
>stt4468869
SQAERTYUVSAASSFFAGATGFFGTGFAGGHTGHTAHGHATAGGTHTTHAHAGHGCHAHAHGHACTHTGHTGGHCAHAANGGGATATAACCAGGTGGAAGGTAGACTACTTTGATAGTTTTTCTCCAGTNGNGCANAAGTTAGTAACAGTGAGAATTTTCTTAGCAATCGCAG
>stt4688097
GCDDDDCJJJJAWDDDDFFFFFCTCATATCGCAGGTGATTCCAACAGATCGCATGAGAGGTATGTCCGAGAGGCAAATCATTCTTTTCGGCTCTATGGATCCGAAGGACCTGCGAAAAGGGCAAAACCGACCTCGGACGAGATTGTGTTTACGGACGAGCATGAGAGGTATGTCCGAGAGGCAAATCATTCTTTTCGGCTCTATGGATCCGAAG

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 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
FASTA_FORMATTER(1)						   User Commands						FASTA_FORMATTER(1)

NAME
fasta_formatter - changes the width of sequences line in a FASTA file DESCRIPTION
usage: fasta_formatter [-h] [-i INFILE] [-o OUTFILE] [-w N] [-t] [-e] Part of FASTX Toolkit 0.0.13.2 by gordon@cshl.edu [-h] = This helpful help screen. [-i INFILE] = FASTA/Q input file. default is STDIN. [-o OUTFILE] = FASTA/Q output file. default is STDOUT. [-w N] = max. sequence line width for output FASTA file. When ZERO (the default), sequence lines will NOT be wrapped - all nucleotides of each sequences will appear on a single line (good for scripting). [-t] = Output tabulated format (instead of FASTA format). Sequence-Identifiers will be on first column, Nucleotides will appear on second column (as single line). [-e] = Output empty sequences (default is to discard them). Empty sequences are ones who have only a sequence identifier, but not actual nucleotides. Input Example: >MY-ID AAAAAGGGGG CCCCCTTTTT AGCTN Output example with unlimited line width [-w 0]: >MY-ID AAAAAGGGGGCCCCCTTTTTAGCTN Output example with max. line width=7 [-w 7]: >MY-ID AAAAAGG GGGTTTT TCCCCCA GCTN Output example with tabular output [-t]: MY-ID AAAAAGGGGGCCCCCTTTTAGCTN example of empty sequence: (will be discarded unless [-e] is used) >REGULAR-SEQUENCE-1 AAAGGGTTTCCC >EMPTY-SEQUENCE >REGULAR-SEQUENCE-2 AAGTAGTAGTAGTAGT GTATTTTATAT SEE ALSO
The quality of this automatically generated manpage might be insufficient. It is suggested to visit http://hannonlab.cshl.edu/fastx_toolkit/commandline.html to get a better layout as well as an overview about connected FASTX tools. fasta_formatter 0.0.13.2 May 2012 FASTA_FORMATTER(1)
All times are GMT -4. The time now is 04:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy