Sponsored Content
Top Forums Shell Programming and Scripting Merge strings from a file into a template Post 302988418 by gimley on Monday 26th of December 2016 07:06:36 AM
Old 12-26-2016
Merge strings from a file into a template

I am preparing a morphological grammar of Marathi to be placed in open-source.
I have two files.
The first file called Adverbs contains a whole list of words, one word per line
A sample is given below:
Code:
आधी
इतक
इतपत
उलट
एवढ
ऐवजी
कड
कडनं
कडल
कडील
कडून
कडे
करता
करिता
खाल
खालती

The second file called Template is a template in which the Adverbs from the first file have to be inserted. The string to be replaced is shown by a symbol
Code:
|

A small sample of the template is provided below:
Code:
ं+|+ही
चा+|+ही
ची+|+ही
चे+|+ही
च्या+|+ही
च्यां+|+ही
|+ही
|+ही+च
|+ही+चं
|+ही+चं+च
|+ही+चा
|+ही+चा+च
|+ही+ची
|+ही+ची+च
|+ही+चे
|+ही+चे+च
|+ही+च्या
|+ही+च्या+च
यां+|+ही

What I am looking for is a script in Perl or Awk which will take each word from the Adverb file, insert it into the template file and put the output of all such insertions in a third file
I work in a Windows environment.
On the occasion of the New Year, may I thank all the members who so unselfishly give their time and efforts to help out by not only providing solutions, but generously comment their code.
Thank you one and all and all good wishes for the New year 2017.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Merge two strings not from files

str1="this oracle data base record" str2="one two three four five" Output: this one oracle two data three base four record five str1 and str2 have the same column but they are not fixed columns. I can do it with "paste" but I do not want to create file everytime the script runs from... (2 Replies)
Discussion started by: buddyme
2 Replies

2. Shell Programming and Scripting

Delete lines in file containing duplicate strings, keeping longer strings

The question is not as simple as the title... I have a file, it looks like this <string name="string1">RZ-LED</string> <string name="string2">2.0</string> <string name="string2">Version 2.0</string> <string name="string3">BP</string> I would like to check for duplicate entries of... (11 Replies)
Discussion started by: raidzero
11 Replies

3. Shell Programming and Scripting

filling in strings in a template file using awk

Hi all, I have a template form to fill in for quite a number of files and I want to automate the filling-in process. the concept seemed to be simple but i cant get it work. the template form is a text file containing the information below: File Name: Date Created: Contents: I need to... (4 Replies)
Discussion started by: ida1215
4 Replies

4. Shell Programming and Scripting

Merge left hand strings mapping to different right hand strings

Hello, I am working on an Urdu to Hindi dictionary which has the following structure: a=b a=c n=d n=q and so on. i.e. Headword separated from gloss by a = I am giving below a live sample بتا=बता بتا=बित्ता بتا=बुत्ता بتان=बतान بتان=बितान بتانا=बिताना I need the following... (3 Replies)
Discussion started by: gimley
3 Replies

5. Programming

Merge two strings by overlapped region

Hello, I am trying to concatenate two strings by merging the overlapped region. E.g. Seq1=ACGTGCCC Seq2=CCCCCGTGTGTGT Seq_merged=ACGTGCCCCCGTGTGTGTFunction strcat(char *dest, char *src) appends the src string to the dest string, ignoring the overlapped parts (prefix of src and suffix of dest).... (30 Replies)
Discussion started by: yifangt
30 Replies

6. Programming

Perl script to merge cells in column1 which has same strings, for all sheets in a excel workbook

Perl script to merge cells ---------- Post updated at 12:59 AM ---------- Previous update was at 12:54 AM ---------- I am using below code to read files from a dir and print to excel. open(my $in, '<', $file) or die "Could not open file: $!"; my $rowCount = 0; my $colCount = 0;... (11 Replies)
Discussion started by: Jack_Bruce
11 Replies

7. Shell Programming and Scripting

Inputing info from a CSV file and filling a template file

Hi, I have a .csv file that contains a variety of fields for 60 clients: USERNAME, PASSWORD, and COMMENTS. I have a template file which contains a great deal of data for each client and has the fields USERNAME, PASSWORD, and COMMENTS that has to be filled with the values of USERNAME,... (1 Reply)
Discussion started by: mojoman
1 Replies

8. Shell Programming and Scripting

Merge strings with ignore case

I have a bi-lingual database of a large number of dictionaries. It so happens that in some a given string is in upper case and in others it is in lower case. An example will illustrate the issue. toll Tax=पथ-कर Toll tax=राहदारी कर toll tax=टोल I want to treat all three instances of toll tax... (3 Replies)
Discussion started by: gimley
3 Replies

9. UNIX for Beginners Questions & Answers

How to pass strings from a list of strings from another file and create multiple files?

Hello Everyone , Iam a newbie to shell programming and iam reaching out if anyone can help in this :- I have two files 1) Insert.txt 2) partition_list.txt insert.txt looks like this :- insert into emp1 partition (partition_name) (a1, b2, c4, s6, d8) select a1, b2, c4, (2 Replies)
Discussion started by: nubie2linux
2 Replies

10. UNIX for Beginners Questions & Answers

Use strings from nth field from one file to match strings in entire line in another file, awk

I cannot seem to get what should be a simple awk one-liner to work correctly and cannot figure out why. I would like to use patterns from a specific field in one file as regex to search for matching strings in the entire line ($0) of another file. I would like to output the lines of File2 which... (1 Reply)
Discussion started by: jvoot
1 Replies
INTLTOOL-UPDATE(8)					      System Manager's Manual						INTLTOOL-UPDATE(8)

NAME
intltool-update - updates PO template file and merge translations with it SYNOPSIS
intltool-update [option]... intltool-update LANGCODE DESCRIPTION
intltool-update generates new po file templates from source code, and merges existing translations with these new po templates. You must change working directory to the subdirectory containing translations (usually "po/") before running intltool-update. OPTIONS
When executing intltool-update , only one mode of operation is allowed each time. Mode of operation -p --pot Generate po template (.pot) only. -s --headers Executes intltool-extract(8) to extract strings inside XML/INI style files listed in POTFILES.in, and writes the extracted strings into header files, so that the strings can be recognised by xgettext(1). -m --maintain Search for left out files, which should have been listed in POTFILES.in or POTFILES.skip. A list of all these files are written into another file called "missing". -r --report Display a status report for all translations in the software. -d LANGCODE --dist LANGCODE Merge LANGCODE.po with existing PO template. Other options -g NAME --gettext-package=NAME Manually specify PO template file name, instead of determining the name automatically from source. Useful with -p/--pot option. This option has an additional effect: the name of current working directory is no more limited to "po" or "po-*". -o FILENAME --output-file=FILENAME Manually specify output FILENAME after merging old translation with PO template. Useful either with -d/--dist option or without any option. -x --verbose Display lots of feedback. --version Show version information. --help Show usage and basic help information. EXAMPLES
Creates a new PO template from source code, and name it foo.pot: intltool-update --pot --gettext-package=foo Updates translation file xy.po using existing po template called "bar.pot", and writes output into "xy1.po": intltool-update --dist --gettext-package=bar --output-file=xy1.po xy Creates new PO template and updates translation file xy.po (xy.po is overwritten with new content): intltool-update xy (same as intltool-update --pot && intltool-update --dist xy) FILES
po/POTFILES.in Contains list of source files which contain translatable strings, one file per line. po/POTFILES.skip po/POTFILES.ignore (obsolete) Contains list of source files which should be ignored when searching for translatable strings. REPORTING BUGS
Report bugs to http://bugs.launchpad.net/intltool AUTHOR
Darin Adler <darin@bentspoon.com> Kenneth Christiansen <kenneth@gnu.org> Maciej Stachowiak <mjs@eazel.com> SEE ALSO
intltoolize(8), intltool-prepare(8), intltool-extract(8), intltool-merge(8), xgettext(1) intltool 2003-08-02 INTLTOOL-UPDATE(8)
All times are GMT -4. The time now is 08:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy