Sponsored Content
Top Forums Shell Programming and Scripting from one word for line to plain text Post 302481297 by mjomba on Friday 17th of December 2010 06:20:44 AM
Old 12-17-2010
from one word for line to plain text

Hello!
I've got a very big file (from tokenization) which has one word for line.
How is it possible then to rebuild the "original" text, knowing that <s> and </s> are the sentence-delimiters?

My file looks like this:
Code:
<s>
&&
tanzania
na
Afrika
kwa
ujumla
ambiwa
na
taifa
kubwa
tajiri
zinduka
na
piga
mwendo
hima
saka
maendeleo
.
</s>
<s>
agizwa
na
fundishwa
fuata
wayo
za
nchi
endelea
wezesha
fikia
hapo
zili
;
</s>
<s>
nayo
itika
wito
huo
.
</s>
<s>
itika
kwa
sauti
kubwa
na
nidhamu
pya
kiasi
kwamba
wakati
moja
rais
wa
serikali
ya
awamu
ya
tatu
,
mheshimiwa
Benjamin
William
pa
,
tunukiwa
na
nchi
hizo
heshima
ya
wa
mwenyekiti
mwenza
wa
tume
ya
utandawazi
pamoja
na
waziri
kuu
wa
nchi
tajiri
ya
Finland
,
bibi
tarja
halonen
.
</s>
<s>
ingi
ona
kwamba
undwa
kwa
tume
hiyo
ni
moja
ya
mbinu
za
ingiza
nchi
(
maskini
)
za
dunia
ya
tatu
katika
mfumo
wa
ubepari
wa
taifa
,
kwa
kauli
mbiu
ya
*
ubia
katika
maendeleo
*
.
</s>
... ... ...

Thanks a lot for any help!
Mjomba

Moderator's Comments:
Mod Comment Use code tags please - you got a PM with guide how to do that, thanks.

Last edited by zaxxon; 12-17-2010 at 07:24 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. AIX

email from root sent my passord in plain text.

Root emailed me this message and thats ok it is supposed to. The thing that concerns me is that the ADMIN password came in plain text. I Xed it out for the purpose of this message of course. Is there a way for me to set this so the password comes encrypted? OR is not included at all in the... (4 Replies)
Discussion started by: rocker40
4 Replies

2. Shell Programming and Scripting

Can a shell script pull the first word (or nth word) off each line of a text file?

Greetings. I am struggling with a shell script to make my life simpler, with a number of practical ways in which it could be used. I want to take a standard text file, and pull the 'n'th word from each line such as the first word from a text file. I'm struggling to see how each line can be... (5 Replies)
Discussion started by: tricky
5 Replies

3. Linux

Plain Text printing issues

I'm attempting to print to a networked konica printer. No linux drivers that I know of exist, but we've always used HP 5si drivers and have had good results. We just loaded a box up with CentOS 5, and now when we print any sort of file from the command line (lp -dkonica <filename>), the text is... (0 Replies)
Discussion started by: fender177
0 Replies

4. Shell Programming and Scripting

Help need to cut the first word of a line in text file

Hi All, I would like help with a script which can get rid of the first work of all lines in text file. File 1 The name is Scott. Output : name is Scott ---------- Post updated at 02:38 PM ---------- Previous update was at 02:37 PM ---------- Hi ALL There is typo error in... (3 Replies)
Discussion started by: bubbly
3 Replies

5. Shell Programming and Scripting

delete " from plain text files

Hi, sorry for bothering with this easy problem but I can't understand... I've a file like this: "4","0x23a3" "5","0x4234" "11","" "20","" "11132","0x6456" I would like to create a file like this: 4,23a3 5,4234 11,999999 20,999999 11132,6456 I've tried: cat INPUT.txt | sed -e... (7 Replies)
Discussion started by: TheMrOrange
7 Replies

6. Shell Programming and Scripting

How to find and print the last word of each line from a text file

Can any one help us in finding the the last word of each line from a text file and print it. eg: 1st --> aaa bbbb cccc dddd eeee ffff ee 2nd --> aab ered er fdf ere ww ww f the o/p should be a below. ee f (1 Reply)
Discussion started by: naveen_sangam
1 Replies

7. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

8. UNIX for Dummies Questions & Answers

Script to add text before the first word on a line in a textfile.

How can i make a script to add text before the first word on a line in a textfile : Example: Old line: is my place New line: this is my place Please use and tags when posting code, data or logs etc. to preserve formatting and enhance readability, thanks. (3 Replies)
Discussion started by: mjanssen
3 Replies

9. Shell Programming and Scripting

Modify one line in a plain text file

Hi everyone, I want to know, if there is a way to modify one line in a text file with unix script, with out re-writing all the file. For example, i have this file: CONFIGURATION_1=XXXX CONFIGURATION_2=YYYY CONFIGURATION_3=ZZZZ supose i have a command or function "modify" that... (7 Replies)
Discussion started by: Xedrox
7 Replies

10. UNIX for Beginners Questions & Answers

Plain text table to csv problems

I´m trying to input a plain text table and I want to output a csv file with semicolon field separator. I have some problems with the \r and the fields with more of one line.. Some gnu util to do this without problems or awk solution? I´m attaching the original plain table file and the needed... (2 Replies)
Discussion started by: faka
2 Replies
ntext(n)					     Alternative Bindings for the Text Widget						  ntext(n)

__________________________________________________________________________________________________________________________________________________

NAME
ntext - Alternative Bindings for the Text Widget SYNOPSIS
package require Tcl 8.5 package require Tk 8.5 package require ntext ?0.81? _________________________________________________________________ DESCRIPTION
The purpose of the ntext package is to make the text widget behave more like other text-editing applications. It makes the text widget more useful for implementing a text editor, and makes it behave in a way that will be more familiar to most users. The package provides a binding tag named Ntext for use by text widgets in place of the default Text binding tag. Package ntext 's functions and variables are contained entirely in the ::ntext namespace; its other code is contained in the binding tag Ntext. ntext has no exports to the global or other namespaces, and no new widget commands. It uses modified copies of the Tk code, leav- ing the original code, and the Text binding tag, unchanged. The differences between the Ntext binding tag and the default Text binding tag are in three categories: o Some Text bindings behave differently from most text-editing applications. Ntext gives these bindings more familiar behaviour. For details see ntextBindings. o When a logical line with leading whitespace is word-wrapped onto more than one display line, the wrapped display lines begin further to the left than the first display line, which can make the text layout untidy and difficult to read. Ntext can indent the wrapped lines to match the leading whitespace of the first display line (this facility is switched off by default). For details see ntex- tIndent. o When the user navigates or selects text, Tcl/Tk sometimes needs to detect word boundaries. Ntext provides improved rules for word boundary detection. For details see ntextWordBreak. The remainder of this page describes the basic use and configuration of all three aspects of Ntext. For more detailed information on the different facilities of Ntext, see the pages ntextBindings, ntextIndent, and ntextWordBreak. See Section EXAMPLE for how to apply the Ntext binding tag in place of the Text binding tag. CONFIGURATION OPTIONS
Ntext provides alternatives to a number of behaviours of the classic Text binding tag. Where there is an option, the Ntext behaviour (except for display-line indentation) is switched on by default. The behaviour of Ntext may be configured application-wide by setting the values of a number of namespace variables: ::ntext::classicAnchor o 0 - (default value) selects Ntext behaviour, i.e. the anchor point is fixed o 1 - selects classic Text behaviour, i.e. the anchor point is variable ::ntext::classicExtras o 0 - (default value) selects Ntext behaviour, i.e. several traditional Text bindings are de-activated o 1 - selects classic Text behaviour, i.e. all Text bindings are activated ::ntext::classicMouseSelect o 0 - (default value) selects Ntext behaviour, i.e. the anchor point for mouse selection operations is moved by keyboard navigation o 1 - selects classic Text behaviour ::ntext::classicWordBreak o 0 - (default value) selects Ntext behaviour, i.e. platform-independent, two classes of word characters and one class of non-word characters. o 1 - selects classic Text behaviour, i.e. platform-dependent, one class of word characters and one class of non-word characters o After changing this value, the matching patterns should be recalculated. See ntextWordBreak for details and advanced configuration options. ::ntext::classicWrap o 0 - selects Ntext behaviour, i.e. display lines of text widgets in -wrap word mode are indented to match the initial whitespace of the first display line of a logical line. If the widget already holds text when this value is set, a function call may be neces- sary. See ntextIndent for detailed instructions on the use of Ntext 's indentation. o 1 - (default value) selects classic Text behaviour, i.e. no indentation ::ntext::overwrite o 0 - (initial value) text typed at the keyboard is inserted into the widget o 1 - text typed at the keyboard overwrites text already in the widget o The value is toggled by the Insert key. EXAMPLE
To create a text widget .t and use the Ntext bindings: package require ntext text .t bindtags .t {.t Ntext . all} See bindtags for more information. SEE ALSO
bindtags, ntextBindings, ntextIndent, ntextWordBreak, re_syntax, regexp, text KEYWORDS
bindtags, re_syntax, regexp, text ntext 0.81 ntext(n)
All times are GMT -4. The time now is 08:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy