Stripping characters from a file and reformatting according to another one
Dear experts,
my problem is pretty tricky.
I want to change a file (see attached input.txt), according to another file (help.txt). The output that is desired is in output.txt. The example is attached.
Note that
-dashes should not be treated specially, they are considered normal characters, too.
-whatever is stripped from the first entry of the input.txt according to the help.txt should be stripped at the identical position in the second entry. (entries are separated by >)
I will really appreciate any help!
Hi there, if i have some strings ie
test_324423
test_242332
test_767667
but I only want the number part (the bolded bit) how do I strip the leftmost 5 characters from the output so that i will have just
324423
242332
767667
any help would be greatly appreciated
Gary (5 Replies)
I am trying to strip out certain characters from a string on both (left & right) sides. For example, line=see@hear|touch, i only want to echo the "hear" part. Well i have tried this approach:
line=see@hear|touch
templine=${line#*@} #removed "see@"
echo ${templine%%\|*} #removed... (4 Replies)
Hi,
How can I reformat a file (text file) using unix command.
This file was FTP'd from Mainframe and contains some garbage character at the end of each line.
Each line contains special characters '<soh>' at the end which should have been spaces when I view it in emacs or nedit. I couldnt do find... (2 Replies)
I want to create a temp file which is named based on a search string. The search string may contain spaces or characters that aren't supposed to be used in filenames so I want to strip those out.
My thought was to use 'tr' with but the result is the opposite of what I want:
$ echo "test... (5 Replies)
I'm using a shell script to get user input with this command:
read UserInput
I would then like to take the "UserInput" variable and strip out all of the following characters, regardless of where they appear in the variable or how many occurrences there are:
\/":|<>+=;,?*@
I'm not sure... (5 Replies)
I hopefully have a simple request - I need to process multiple files reformatting the output based on tags at the beginning of each line. So the data for the new 3 lines of the output file are in the HDR line and then the details are in the DTL tagged lines.
for ifile in $indir
do
echo... (1 Reply)
Dear ALL,
I would really appreciate if you could help me in reformatting a file in this way:
The file refers to a list of genetic coordinates, each lines has a score value and the associated chromosome is listed in the line starting with chrom .
If more coordinates are found, the start... (2 Replies)
I wrote myself a small little shell script to clean up a file I have issues with. In particular, I am stripping down a fully qualified host/domain name to just the hostname itself. The script works, but from a performance standpoint, it's not very fast and I will be working with large data sets.
... (4 Replies)
Hi,
I have an input file that looks like this (columns are tab delimited:
Data000005-RA GO:0003735 GO:0005840 GO:0006412
Data000005-RA GO:0003735
Data000009-RA GO:0003735 GO:0005622 GO:0005840 GO:0006412 ... (2 Replies)
BP_REVTRANS-MOTIF(1p) User Contributed Perl Documentation BP_REVTRANS-MOTIF(1p)NAME
revtrans-motif - Reverse translate a Profam-like protein motif
VERSION
Version 0.01
SYNOPSIS
From a file:
revtrans-motif.pl -i motifs.txt
Using pipes:
revtrans-motif.pl < motifs.txt > output.txt
Using interactively at the command prompt:
$ revtrans-motif.pl
MAAEEL[VIKP]
1. ATGGCNGCNGARGARYTNVHN
[^P]H(IW){2,3}
2. NDNCAY(ATHTGG){2,3}
DESCRIPTION
This script takes a protein motif as input and returns a degenerate oligonucleotide sequence corresponding to it. The main reason for doing
this is to design degenerate primers that amplify a given sequence pattern.
The input motif consists of a string of one-letter residues, with any of the following syntactic elements:
[...] : Redundant position.
A position in which more than one residue is allowed. Example:
[TS]YW[RKSD]
^^ ^^^^
[^...] : Negated position.
A position in which any residue is allowed, saved for those between brackets. Example:
[^PW]MK[LAE]
^^
(...){n,m,...} : Repeated motif.
A motif that is repeated n or m times. It can have any of the previous syntactic elements. Example:
A[SN]C(TXX){2,4,8}
^^^
The allowed letters are those that correspond to the 20 natural aminoacids, plus:
B = N + D
Z = Q + E
X = All
OPTIONS -i input-file:
A file with a list of motifs to reverse translate.
-h
Display this help message.
AUTHOR
Bruno Vecchi, "vecchi.b at gmail.com"
BUGS
Please report any bugs or feature requests to "vecchi.b at gmail.com"
COPYRIGHT & LICENSE
Copyright 2009 Bruno Vecchi, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-03-02 BP_REVTRANS-MOTIF(1p)