03-10-2008
Replacing the last character
Hi ,
I need to change the last character of the line:
ie:
input file:
(raj,
muthu,
mani,
Output:
(raj,
muthu,
mani);
so i need to change the last comma by the closing braces so help me out in the issue.
Thanks in advance.
10 More Discussions You Might Find Interesting
1. Linux
Hi
1) I need to replace an "enter" character with another character.
I thought it should be like this (E.G)
replace all stirngs "LIAV"+enter with kokokoko:
:1,$s/LIAV^M/kokokoko/g
but it dose not work.
2) Also dose nayone know how to replace wildcards?
for... (3 Replies)
Discussion started by: liav
3 Replies
2. Shell Programming and Scripting
hi
i have a file and reading line by line, i need to replace 8-15 and 18-27 charaters with character 'x'.
Eg: satyasatxxxxxxxsatxxxxxxxxxtyasatyasatyasatyasatyasatya
please help
thanks
Satya (1 Reply)
Discussion started by: Satyak
1 Replies
3. UNIX for Dummies Questions & Answers
Hi All,
I would like to know how, iff at all we can, we may use the 'tr' command to replace a single character with multiple characters.
eg: if i have a string valued "him", how can i use 'tr' to replace 'i' with "oo" to make "hoom".
Just replacing a single character by many.
tried:-... (16 Replies)
Discussion started by: hkansal
16 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
contents of my file is like this:
xxx xxx1 N N N 0
yyy yyy1 Y N N 0
i want to replace 1st N of xxx xxx1 N N N 0 line with Y.
i. e i want the output like this:
xxx xxx1 Y N N 0
how can i do this?
please help.
Thanks (8 Replies)
Discussion started by: Usha Shastri
8 Replies
5. UNIX for Dummies Questions & Answers
Hi All
I want to replace a character in a line, but position will be different form one iteration to another.
So i m keeping the position i a variable.
I am trying with following code
pos=3
echo "Hello World, Good Morning" | sed 's/\(.\{$pos\}\)./\1Y/'
But its not working, Can you... (2 Replies)
Discussion started by: Usha Shastri
2 Replies
6. Shell Programming and Scripting
Hello,
I have a csv file and will like to replace the last character of each line in the file with Z (20 Replies)
Discussion started by: 123script
20 Replies
7. Shell Programming and Scripting
Hi Experts,
We are facing some while loading the "csv" file to target table.Some of the records are having values as :
Account number,Name,Address
"123","XYZ","302 Street,Washington,US"
"456","PQR"," 3233 Some Street,
Washington,US"
In the above file instead reading only two records it... (11 Replies)
Discussion started by: Amey Joshi
11 Replies
8. Shell Programming and Scripting
I have a file (pema)with a single long record which i have to break up into multiple lines
Input
s1aaaaaaaaaaaaaaaaaaaaaaas1bbbbbbbbbbs1cccccccccc
Output
s1aaaaaaaaaaaaaaaaaaaaaaa
s1bbbbbbbbbb
s1cccccccccc
m planning to do it by replacing s1 by \ns1 \n is the new line character
i... (5 Replies)
Discussion started by: pema.yozer
5 Replies
9. Shell Programming and Scripting
Hi, I need to replace a character between two numbers (specifically a - to a _). The problem is that they can be *any* numbers. So, I need a one liner to turn a file like this:
1-2
3-4
55-66
4323-12312893
into the following
1_2
3_4
55_66
4323_12312893
Any help would be appreciated! (5 Replies)
Discussion started by: mikey11415
5 Replies
10. UNIX for Dummies Questions & Answers
Hi All,
I have a text file that contains
I1SP2 *=*=Y=M=D001D
My requirement is to replace all occurrence of =* to =Z
expected o/p is I1SP2 *=Z=Y=M=D001D
I have tried with
sed 's/=*/=Z/g' file
sed 's!\=*!\=Z/g' file
sed 's!\=*!\=Z!g' file
sed 's!\=\*!\=Z!g' file
but its not... (3 Replies)
Discussion started by: gotamp
3 Replies
LEARN ABOUT DEBIAN
simhash
SIMHASH(1) General Commands Manual SIMHASH(1)
NAME
simhash - file similarity hash tool
SYNOPSIS
simhash [ -s nshingles ] [ -f nfeatures ] [ file ]
simhash [ -s nshingles ] [ -f nfeatures ] -w file ...
simhash [ -s nshingles ] [ -f nfeatures ] -m file ...
simhash -c hashfile hashfile
DESCRIPTION
This program is used to compute and compare similarity hashes of files. A similarity hash is a chunk of data that has the property that
some distance metric between files is proportional to some distance metric between the hashes. Typically the similarity hash will be much
smaller than the file itself.
The algorithm used by simhash is Manassas' "shingleprinting" algorithm (see BIBLIOGRAPHY below): take a hash of every m-byte subsequence of
the file, and retain the n of these hashes that are numerically smallest. The size of the intersection of the hash sets of two files gives
a statistically good estimate of the similarity of the files as a whole.
In its default mode, simhash will compute the similarity hash of its file argument (or stdin) and write this hash to its standard output.
When invoked with the -w argument (see below), simhash will compute similarity hashes of all of its file arguments in "batch mode". When
invoked with the -m argument (see below), simhash will compare all the given files using similarity hashes in "match mode". Finally, when
invoked with the -c argument (see below), simhash will report the degree of similarity between two hashes.
OPTIONS
-f feature-count
When computing a similarity hash, retain at most feature-count significant hashes from the target file. The default is 128 fea-
tures. Larger feature counts will give higher resolution in differences between files, will increase the size of the similarity
hash proportionally to the feature count, and will increase similarity hash computation time slightly.
-s shingle-size
When computing a similarity hash, use hashes of samples consisting of shingle-size consecutive bytes drawn from the target file.
The default is 8 bytes, the minimum is 4 bytes. Larger shingle sizes will emphasize the differences between files more and will
slow the similarity hash computation proportionally to the shingle size.
-c hashfile1 hashfile2
Display the distance (normalized to the range 0..1) between the similarity hash stored in hashfile1 and the similarity hash stored
in hashfile2.
-w file ...
Write the similarity hash of each of the file arguments to file.sim.
-m file ...
Compute the similarity hash of each of the file arguments, and output a similarity matrix for those files.
AUTHOR
Bart Massey <bart@cs.pdx.edu>
BUGS
This currently uses CRC32 for the hashing. A Rabin Fingerprint should be offered as a slightly slower but more reliable alternative.
The shingleprinting algorithm works for text files and fairly well for other sequential filetypes, but does not work well for image files.
The latter both are 2D and often undergo odd transformations.
BIBLIOGRAPHY
Mark Manasse, Microsoft Research Silicon Valley. Finding similar things quickly in large collections. http://research.micro-
soft.com/research/sv/PageTurner/similarity.htm
Andrei Z. Broder. On the resemblance and containment of documents. In Compression and Complexity of Sequences (SEQUENCES'97), pages
21-29. IEEE Computer Society, 1998. ftp://ftp.digital.com/pub/DEC/SRC/publications/broder/positano-final-wpnums.pdf
Andrei Z. Broder. Some applications of Rabin's fingerprinting method. Published in R. Capocelli, A. De Santis, U. Vaccaro eds., Sequences
II: Methods in Communications, Security, and Computer Science, Springer-Verlag, 1993. http://athos.rutgers.edu/~muthu/broder.ps
3 January 2007 SIMHASH(1)