Sponsored Content
Top Forums Shell Programming and Scripting Find and replace in a file from another file Post 303005848 by gimley on Tuesday 24th of October 2017 05:02:10 AM
Old 10-24-2017
Many thanks for your queries:
My answers to both
  1. I tried to write a search and replace tool in Java. But unfortunately it does not accept punctuation markers and the preprocess.rul file fails and does not do the requisite replacement. In fact the rule file I posted is the rule file which I used for the Java search and replace.
  2. No the list is not integral it is partial and as I explore the database, some more cases may arise. But on the whole, all punctuation markers need to be replaced by a space followed by the punctuation marker.
Any script in Awk or Perl which can do this.
Thanks a lot

Last edited by rbatte1; 10-24-2017 at 06:24 AM.. Reason: Formatted numbered list with LIST=1 tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find replace within a file?

I build several files by using the cut command to grab select fields(columns) from a really bid csv file. Each file is one column of data. I then put them together using paste command. Here is the code built in tcsh: cut -d , -f 1 some.csv > 1.csv cut -d , -f 10 some.csv > 10.csv paste 1.csv... (2 Replies)
Discussion started by: yankee428
2 Replies

2. Shell Programming and Scripting

find and replace pattren in file

Hi, I have the input file having data as follow: file1.txt 001 aaa_1:abcd 002 bbb_2:abcd I want output as, 001xabcd 002xabcd Here iam trying to replace "{1 space}{alphanumeric string with underscore}{:}" with characrter "x". I tried to achieve this using sed;but Iam not getting this... (5 Replies)
Discussion started by: gopalss
5 Replies

3. Shell Programming and Scripting

Find and replace in a file

Hi everyone, I am new to the world of shell script programming. I have a file named Fnd1.txt which has the contents as below. I need to replace the \t with the tab space. Can any one help me to write a perl scipt for this. USA45V1\tG\t341029 USAV1T1\tG\t450545 USAREJ1\tG\t572645... (5 Replies)
Discussion started by: vinay123
5 Replies

4. Shell Programming and Scripting

Find and replace in a gz file

Is there a way to do a find and replace in a .gz file in a single script ? I can always unzip, find and replace and then zip it again but would hate to do this everytime. Thanks ! Vivek (1 Reply)
Discussion started by: vashah
1 Replies

5. Shell Programming and Scripting

find and replace a string in a file without the use of temp file

Hi - I am looking for a replacing a string in a in multiple *.sql files in directory with a new string without using a temporary file Normally I can use sed command as below for W in ls `FILE*.sql` do sed 's/OLD/NEW/g' $W > TEMPFILE.dat mv TEMPFILE.dat $W done But Here in my... (9 Replies)
Discussion started by: raghutapal
9 Replies

6. Shell Programming and Scripting

How to find a certain string in a file and replace it with a value from another file using sed/awk?

Hi Everyone, I am new to this forum and new to sed/awk programming too !! I need to find particular string in file1(text file) and replace it with a value from another text file(file2) the file2 has only one line and the value to be replaced with is in the second column. file 1: (assert (=... (21 Replies)
Discussion started by: paramad
21 Replies

7. Shell Programming and Scripting

Find and Replace in File

Legends, I have a file /tmp/list.txt I want to find "/bin/" and replace it with "/log/" I tried the follwoing but no luck Sandy: /tmp> perl -pi -e 's/\/bin\/\/log\/' /tmp/list.txt >> /tmp/try Substitution pattern not terminated at -e line 1. AND, Sandy: /tmp> perl -pi -e... (2 Replies)
Discussion started by: sdosanjh
2 Replies

8. Shell Programming and Scripting

Find/replace in file from another file.

Dear Shell Expert, I have requirement of replacing passwd field in number of files based on username in them. The matching username and "new" password in available in a separate file. below is the sample for both. #sample of one of the file content, red highlighted field are username and... (20 Replies)
Discussion started by: KDDubai333
20 Replies

9. Shell Programming and Scripting

Perl script to read string from file#1 and find/replace in file#2

Hello Forum. I have a file called abc.sed with the following commands; s/1/one/g s/2/two/g ... I also have a second file called abc.dat and would like to substitute all occurrences of "1 with one", "2 with two", etc and create a new file called abc_new.dat sed -f abc.sed abc.dat >... (10 Replies)
Discussion started by: pchang
10 Replies

10. UNIX for Beginners Questions & Answers

Need to find and replace in a file

Hi All, I am having below sample data in a file. I need to find all the line form this file with word ABC and i need to replace the characters at position 120 which is "CO:BOGFDUI"(30chars) in the lines with blank space. I have tried using grep to find the word with ABC (grep ABC filename),... (3 Replies)
Discussion started by: abhi_123
3 Replies
Lingua::Stem::Fr(3pm)					User Contributed Perl Documentation				     Lingua::Stem::Fr(3pm)

NAME
Lingua::Stem::Fr - Perl French Stemming SYNOPSIS
use Lingua::Stem::Fr; my $stems = Lingua::Stem::Fr::stem({ -words => $word_list_reference, -locale => 'fr', -exceptions => $exceptions_hash, }); my $stem = Lingua::Stem::Fr::stem_word( $word ); DESCRIPTION
This module use the a modified version of the Porter Stemming Algorithm to return a stemmed words. The algorithm is implemented as described in: http://snowball.tartarus.org/french/stemmer.html with some improvement. The code is carefully crafted to work in conjunction with the Lingua::Stem module by Benjamin Franz. This french version is based too, on the work of Aldo Calpini (Italian Version) METHODS
o stem({ -words => @words, -locale => 'fr', -exceptions => \%exceptions }); Stems a list of passed words. Returns an anonymous list reference to the stemmed words. Example: my $stemmed_words = Lingua::Stem::Fr::stem({ -words => @words, -locale => 'fr', -exceptions => \%exceptions, }); o stem_word( $word ); Stems a single word and returns the stem directly. Example: my $stem = Lingua::Stem::Fr::stem_word( $word ); o stem_caching({ -level => 0|1|2 }); Sets the level of stem caching. '0' means 'no caching'. This is the default level. '1' means 'cache per run'. This caches stemming results during a single call to 'stem'. '2' means 'cache indefinitely'. This caches stemming results until either the process exits or the 'clear_stem_cache' method is called. o clear_stem_cache; Clears the cache of stemmed words HISTORY
0.01 Original version; created by h2xs 1.23 with options -ACX -n Lingua::Stem::Fr 0.02 Minor change in documentation and disable of limitation to perl 5.8.3+ SEE ALSO
You can see the French stemming algorithm from Mr Porter here : http://snowball.tartarus.org/french/stemmer.html Another French stemming tool in Perl (French page) : http://www.univ-nancy2.fr/pers/namer/Telecharger_Flemm.html AUTHOR
Sebastien Darribere-Pleyt, <sebastien.darribere@lefute.com> COPYRIGHT AND LICENSE
Copyright (C) 2003 by Aldo Calpini <dada@perl.it> Copyright (C) 2004 by Sebastien Darribere-Pleyt <sebastien.darribere@lefute.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 563: Expected '=item *' Around line 571: Expected '=item *' Around line 583: Expected '=item *' perl v5.10.1 2007-10-23 Lingua::Stem::Fr(3pm)
All times are GMT -4. The time now is 02:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy