Replacing Multiple spaces with a single space but excluding few regular expressions
Hi All.
Attached are two files.
I ran a query and have the output as in the file with name "FILEWITHFOURRECORDS.txt "
I didn't want all the spaces between the columns so I squeezed the spaces with the "tr" command and also added a carriage return at the end of every line.
But in two columns I.e., the second and third column, I have a description where it has spaces in between and it should NOT be removed. But as I apply a 'tr' on the whole file, even those spaces are removed.
Could you please help me, how to retain the spaces in that string and replace everything else.
Below is how it looks after removing spaces:
It should look like this:
Any suggestion will be very helpful. Please let me know if my question is not clear!
I want to write a script which will check the arguments and if there is a single space(if 2 more more space in a row , then do not touch), replace it with _ and then gather the argument
so, program will be ran
./programname hi hello hi usa now hello hello
so, inside of program,... (7 Replies)
I'm reading from a file that is semi-colon delimited. One of the fields contains 2 spaces separating the first and last name (4th field in - "JOHN<space><space> DOE"):
e.g. TORONTO;ONTARIO;1 YONGE STREET;JOHN DOE;CANADA
When I read this record and either echo/print to screen or write to... (4 Replies)
I am searching while I await a response to this so if it has been asked already I apologize.
I have a file with lines in it that look like:
bob johnson email@email.org
I need it to look like:
bob:johnson:email@email.org
I am trying to use sed like this:
sed -e 's/ /:/g' file >... (5 Replies)
Hello,
I need help with using grep and regular expressions....
I have a long list of about 1000 lines of Chinese flashcards. Here's a small excerpt:
意文 yìwén (given name)
貴姓 guìxìng (honorable surname)
貴 guì (honorable)
姓 xìng (one's surname is; to be surnamed; surname)
呢 ne (interrogative... (2 Replies)
consider the small piece of code
while read line
do
echo $line
done < example
content of example file
sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr
the output is like
sadasdasdasdsa erwerewrwr ergdgdfgf rgerg erwererwr
the... (4 Replies)
Hi All,
Can please let me know what is the difference between the single line mode and multi line mode in regular expresions?
Thanks,
Chidhambaram B (3 Replies)
I am trying to read a txt file and trying to translate multiples spaces into single spaces so the file is more organized, but whenever I try the command:
tr ' ' ' ' w.txt
The output is:
tr: extra operand `w.txt'
Try `tr --help' for more information.
Can someone please help? :wall:
... (2 Replies)
Platform : RHEL 5.8
I want to end each line of this file with a single quote.
$ cat hello.txt
blueskies
minnie
mickey
gravity
snoopyAt VI editor's command mode, I have used the following command to replace the last character with a single quote.
~
~
~
:%s/$/'/gNow, the lines in the... (10 Replies)
I am looking for a regular expression that uses sed to replace multiple spaces with single spaces on every line where it is not at the start of the line and not immediately before double slashes ('//') or between quotes (").
In its simplest form, it would look like this:
sed -e 's# # #g'... (4 Replies)
Im looking for a bash solution that will use Regular Expressions (not perl, sed or awk) to check the example data below and then give me a status.
which would be just simply Match or Mismatch.
SYS PS1 is present.
Fan status: Normal
Input Voltage status: Normal
... (5 Replies)
Discussion started by: popeye
5 Replies
LEARN ABOUT DEBIAN
glam2-purge
GLAM2-PURGE(1) glam2 Manual GLAM2-PURGE(1)NAME
glam2-purge - Removes redundant sequences from a FASTA file
SYNOPSIS
glam2-purge file score [options]
DESCRIPTION
glam2-purge is a modified version of Andrew Neuwald's purge program that removes redundant sequences from a FASTA file. This is recommended
in order to prevent highly similar sequences distorting the search for motifs. Purge works with either DNA or protein sequences and creates
an output file such that no two sequences have a (gapless) local alignment score greater than a threshold specified by the user. The output
file is named <file>.<score>. The alignment score is based on the BLOSUM62 matrix for proteins, and on a +5/-1 scoring scheme for DNA.
Purge can also be used to mask tandem repeats. It uses the XNU program for this purpose.
OPTIONS -n
Sequences are DNA (default: protein).
-b
Use blast heuristic method (default for protein).
-e
Use an exhaustive method (default for DNA).
-q
Keep first sequence in the set.
-x
Use xnu to mask protein tandem repeats.
SEE ALSO glam2(1), glam2format(1), glam2mask(1), glam2scan(1), xnu(1)
The full Hypertext documentation of GLAM2 is available online at http://bioinformatics.org.au/glam2/ or on this computer in
/usr/share/doc/glam2/.
REFERENCES
Purge was written by Andy Neuwald and is described in more detail in Neuwald et al., "Gibbs motif sampling: detection of bacterial outer
membrane protein repeats", Protein Science, 4:1618-1632, 1995. Please cite it if you use Purge.
If you use GLAM2, please cite: MC Frith, NFW Saunders, B Kobe, TL Bailey (2008) Discovering sequence motifs with arbitrary insertions and
deletions, PLoS Computational Biology (in press).
AUTHORS
Andrew Neuwald
Author of purge, renamed glam2-purge in Debian.
Martin Frith
Modified purge to be ANSI standard C and improved the user interface.
Timothy Bailey
Modified purge to be ANSI standard C and improved the user interface.
Charles Plessy <plessy@debian.org>
Formatted this manpage in DocBook XML for the Debian distribution.
COPYRIGHT
The source code and the documentation of Purge and GLAM2 are released in the public domain.
GLAM2 1056 05/19/2008 GLAM2-PURGE(1)