I have a solution, but it seems labored. I would like to compare strings return a value in percent out of 100.
Such as:
i.e., 'abc' is 300% longer than 'a'
For beginners: s1=${#text1} will return the length of $text1. In this case it would return '1' because it is one character long ('a').
I've looked at the man pages for 'diff' and some others and haven't figured out an easy way that this could be done in a more simple manner; yet, something tells me I'm missing something. I'm repeating the formulas, and I'm wondering if there is perhaps some way to do an inverse of a result... Anyways, it seems redundant.
I need to compare two files with exactly same length as example: -
File1 contain 500 records with length of 640 chars of each line.
File2 contain 1500 records with length of 640 chars of each line.
I need get an output to be written in File3 which will contain 1000 records difference.
but... (4 Replies)
Need a script that manipulates a fixed length file that will compare 2 fields in that file and if they are equal write that line to a new file.
i.e. If fields 87-93 = fields 119-125, then write the entire line to a new file. Do this for every line in the file. After we get only the fields... (1 Reply)
I have two very large datasets (>100MB) in a simple vertical list format. They are of different size and with different order and formatting (e.g. whitespace and some other minor cruft that would thwart easy regex).
Let's call them set1 and set2.
I want to check set2 to see if it contains... (2 Replies)
Hi,
Can anyone help with a effective solution ?
I need to change a variable length text field (between 1 - 18 characters) to a fixed length text of 18 characters with the unused portion, at the end, filled with spaces.
The text field is actually field 10 of a .csv file however I could cut... (7 Replies)
Hello,
Is there anyway that I can align a pipe delimited text file by the maxium field length where the field is separated out by pipes for large text files with more than
100,000 rows?
So, far I have searched other forums and google about aligning text files in unix and I have noticed that... (7 Replies)
I am trying to get text from a webpage, in terminal form. So far I am:
1. getting the html for the page printed using curl (curl -s webpage.com), which is then
2. piped to awk, printing line number 29 (awk NR==29), then
3. this is where I am sort of lost. I know where in the printed line I... (7 Replies)
The awk below using the sample input would output the following: Basically, it averages the text in $5 that matches if $7 < 30 .
awk '{if(len==0){last=$5;total=$7;len=1;getline}if($5!=last){printf("%s\t%f\n", last,... (6 Replies)
Hi,
I want to compare strings length to a number but i am getting error. I want first name should be length of 8.
Please help.
#bin !/bin/bash
clear
echo -n "Enter name "
read name
IFS=_
ary=($name)
for key in "${!ary}"; do echo "$key${ary}"; done
##First name should be equal to 8... (8 Replies)
Hi,
I have a text file with sample records as
CASE ID: 20170218881083
Original presentment record for ARN not found
for Re-presentment
I want to extract the 23 digit number from this file. I thought of using grep but initially couldn't extract the required number. However, after... (16 Replies)
Discussion started by: dsid
16 Replies
LEARN ABOUT DEBIAN
xml::tmx::writer
XML::TMX::Writer(3pm) User Contributed Perl Documentation XML::TMX::Writer(3pm)NAME
XML::TMX::Writer - Perl extension for writing TMX files
SYNOPSIS
use XML::TMX::Writer;
my $tmx = new XML::TMX::Writer();
$tmx->start_tmx(id => 'paulojjs');
$tmx->add_tu(SRCLANG => 'en', 'en' => 'some text', 'pt' => 'algum texto');
$tmx->add_tu(SRCLANG => 'en',
'en' => 'some text',
'pt' => 'algum texto',
-note => [32, 34 ],
-prop => { q => 23,
aut => "jj"}
);
$tmx->end_tmx();
DESCRIPTION
This module provides a simple way for writing TMX files.
METHODS
The following methods are available:
new
$tmx = new XML::TMX::Writer();
Creates a new XML::TMX::Writer object
start_tmx
$tmx->start_tmx(-output => 'some_file.tmx');
Begins a TMX file. Several options are available:
-output
Output of the TMX, if none is defined stdout is used by default.
tool
Tool used to create the TMX. Defaults to 'XML::TMX::Writer'
toolversion
Some version identification of the tool used to create the TMX. Defaults to the current module version
segtype
Segment type used in the <tu> elements. Possible values are block, paragraph, sentence and phrase. Defaults to sentence.
srctmf
Specifies the format of the translation memory file from which the TMX document or segment thereof have been generated.
adminlang
Specifies the default language for the administrative and informative elements <note> and <prop>.
srclang
Specifies the language of the source text. If a <tu> element does not have a srclang attribute specified, it uses the one defined in
the <header> element. Defaults to *all*.
datatype
Specifies the type of data contained in the element. Depending on that type, you may apply different processes to the data.
The recommended values for the datatype attribute are as follow (this list is not exhaustive):
unknown
undefined
alptext
WinJoust data
cdf Channel Definition Format
cmx Corel CMX Format
cpp C and C++ style text
hptag
HP-Tag
html
HTML, DHTML, etc
interleaf
Interleaf documents
ipf IPF/BookMaster
java
Java, source and property files
javascript
JavaScript, ECMAScript scripts
lisp
Lisp
mif Framemaker MIF, MML, etc
opentag
OpenTag data
pascal
Pascal, Delphi style text
plaintext
Plain text (default)
pm PageMaker
rtf Rich Text Format
sgml
SGML
stf-f
S-Tagger for FrameMaker
stf-i
S-Tagger for Interleaf
transit
Transit data
vbscript
Visual Basic scripts
winres
Windows resources from RC, DLL, EXE
xml XML
xptag
Quark XPressTag
srcencoding
All TMX documents are in Unicode. However, it is sometimes useful to know what code set was used to encode text that was converted to
Unicode for purposes of interchange. This option specifies the original or preferred code set of the data of the element in case it is
to be re-encoded in a non-Unicode code set. Defaults to none.
id Specifies the identifier of the user who created the element. Defaults to none.
-note
A reference to a list of notes to be added in the header.
-prop
A reference fo a hash of properties to be added in the header. Keys are used as the "type" attribute, value as the tag contents.
add_tu
$tmx->add_tu(srclang => LANG1, LANG1 => 'text1', LANG2 => 'text2');
$tmx->add_tu(srclang => LANG1,
LANG1 => 'text1',
LANG2 => 'text2',
-note => ["value1", ## notes
"value2"],
-prop => { type1 => ["value1","value"], #multiple values
_ => 'value2', # anonymound properties
typen => ["valuen"],}
);
Adds a translation unit to the TMX file. Several optional labels can be specified:
id Specifies an identifier for the <tu> element. Its value is not defined by the standard (it could be unique or not, numeric or
alphanumeric, etc.).
srcencoding
Same meaning as told in start_tmx method.
datatype
Same meaning as told in start_tmx method.
segtype
Same meaning as told in start_tmx method.
srclang
Same meaning as told in start_tmx method.
end_tmx
$tmx->end_tmx();
Ends the TMX file, closing file handles if necessary.
SEE ALSO
TMX Specification <http://www.lisa.org/tmx/tmx.htm>
AUTHOR
Paulo Jorge Jesus Silva, <paulojjs@bragatel.pt>
Alberto Simo~es, <albie@alfarrabio.di.uminho.pt>
COPYRIGHT AND LICENSE
Copyright 2003 by Projecto Natura
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.14.2 2012-06-05 XML::TMX::Writer(3pm)