Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Replacing stopwords based on a list Post 302939583 by A-V on Thursday 26th of March 2015 04:19:18 PM
Old 03-26-2015
Error Replacing stopwords based on a list

Dear all,
I have Files with lines of text in them, I want to replace the stopwords in them with ",".
I have create a file which contain the stopwords...

I have been trying for last 3 hours but no success
I have managed to replace one using "sed" and delete the line containing them using "grep" but no actually the whole thing

failed examples
Code:
cat $X | sed "s/\<a\>/\,/g"

and
Code:
grep -v -F -f stopwords.txt mainfiles.txt > newfiles.txt


was wondering whether you can help me ...
Thanks a lot in advance

P.S. using sed I face the problem of case-sensitivity as well

Last edited by A-V; 03-26-2015 at 06:00 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing text based on replacement tables

Dear all, will be grateful for your advices.. The need is (i guess) simple for UNIX experts. Basically, there are replacement tables, which would be used to replace text strings in the data (large volumes..). An exmpl table (a "config file"): VIFIS1_1_PE1836 VIBRIO_FISCHERI VIPAR1_1_PE1662 ... (7 Replies)
Discussion started by: roussine
7 Replies

2. Shell Programming and Scripting

Replacing Character in a file based on element

Hi, I have file like below. Unix:/pclls/turc>cat tibc.property executeReceiver=Y executeSender=Y I want to replace executeSender=N in the file. My file should be like below. executeReceiver=Y executeSender=N I tried with the below command, its giving error. cat tibc.property |... (2 Replies)
Discussion started by: senthil_is
2 Replies

3. UNIX for Dummies Questions & Answers

Script for replacing text in a file based on list

Hi All, I am fairly new to the world of Unix, and I am looking for a way to replace a line of text in a file with a delimited array of values. I have an aliases file that is currently in use on our mail server that we are migrating off of. Until the migration is complete, the server must stay... (8 Replies)
Discussion started by: phoenixjc
8 Replies

4. Shell Programming and Scripting

Replacing headers based on a second file

I have a file with thousands of sequences that looks like this: I need to replace the headers using a second file Thus, I will end up having the following file: I am looking for an AWK script that I can easily plug in my current pipeline. Any help will be greatly appreciated! (6 Replies)
Discussion started by: Xterra
6 Replies

5. Shell Programming and Scripting

Replacing the text in a row based on certain condition

Hi All, I felt tough to frame my question. Any way find my below input. (.CSV file) SNo, City 1, Chennai 2, None 3, Delhi 4,None Note that I have many rows ans also other columns beside my City column. What I need is the below output. SNo, City 1, Chennai 2, Chennai_new 3, Delhi... (2 Replies)
Discussion started by: ks_reddy
2 Replies

6. Shell Programming and Scripting

Finding/replacing strings in some files based on a file

Hi, We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies

7. Shell Programming and Scripting

Help with awk replacing identical columns based on another file

Hello, I am using Awk in UBUNTU 12.04. I have a file like following with three fields and 44706 rows. F1 A A F2 G G F3 A T I have another file like this: AL_1 F1 A A AL_2 F1 A T AL_3 F1 A A AL_1 F2 G G AL_2 F2 G A AL_3 F2 G G BO_1 F1 A A BO_2 F1 A T... (6 Replies)
Discussion started by: Homa
6 Replies

8. Shell Programming and Scripting

Replacing a character with a number based on lines

Hi, I am in need of help for the two things which is to be done. First, I have a file that has around four columns. The first column is filled with letter "A". There are around 400 lines in the files as shown below. A 1 5.2 3.2 A 2 0.2 4.5 A 1 2.2 2.2 A 5 2.1 ... (2 Replies)
Discussion started by: begin_shell
2 Replies

9. UNIX for Advanced & Expert Users

Replacing string length based on pattern

Hi All, I have a file which is like below. I need to read all the patterns that starts with P and then replace the 9 digit values to 8 digit values (remove leading integer). Can you please help Example : ( Please look below File) File : P,1 M1,... (7 Replies)
Discussion started by: arunkumar_mca
7 Replies

10. UNIX for Beginners Questions & Answers

Replacing tag based on condition

Hi All, I am having a file like below. The file will having information about the records.If you see the file the file is header and data. For example it have 1 men tag and the tag id will be come after headers. The change is I want to convert All pets tag from P to X. I did a sed like below... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
hiutil(1)						    BSD General Commands Manual 						 hiutil(1)

NAME
hiutil -- utility for creating and examining Help Viewer indices SYNOPSIS
hiutil -Cf file [-1agv] [-m NUM] [-s LANG | PATH] [-r URL] [-t EXT] dir hiutil [-ADEFMRS] -f file DESCRIPTION
hiutil is for creating and examining .helpindex files. These files were historically created by Help Indexer.app, which now calls this tool. There are several different (and mutually-exclusive) modes: -C, --create Create an index file at the location you specify. You must provide both a directory of HTML files to index and path to an output file, which will be overwritten if it exists. -A, --list-anchors List the index's anchors separated by newlines. -D, --list-anchor-dictionary List the index's anchor dictionary in XML. This includes a list of which files contain each anchor. -E, --list-index-versions List the index's version dictionary in XML. It describes the system environment on which the index was created. -F, --list-files List all the files included in the index, separated by newlines. You can use the -v option with this mode to get titles and descrip- tions as well. -H, --help Prints out usage data. -M, --list-min-term-length List the index's minimum term length. -R, --list-remote-url List the index's remote URL. (This is only relevant for old-style indexes which include one.) -S, --list-stopwords List the index's stopwords separated by newlines. -V, --version Prints out the version of the tool. GENERAL OPTIONS
These can be used with any mode. -f, --file P ass in the path to a file, either one to be created or one to be examined. -v, --verbose Verbose output. Errors are always shown, but passing this argument once will print out warnings too. Twice will print out errors, warnings and progress notes. This can be a lot of data! CREATE OPTIONS
These can only be used with the create mode. -1 Index one file at a time. The default is to use a queue to index several files in parallel. In combination with -vvv, this option can be useful in determining which file an error message is from. -a, --anchors Index anchors. The default is not to. Without this flag, there will be no anchor dictionary in the index. -e, --exclude=PATTERN Exclude files which match this pattern. Uses NSPredicate's MATCHES comparison method on the file's path relative to the directory being indexed. This option can be passed as many times as necessary, once per pattern. Exclusions take precedence over files included with -i. -g, --generate-summaries Generate summary text. This can be slow, but is useful if you don't have DESCRIPTION meta tags on some pages. -i, --include=PATTERN Include files which match this pattern. Uses NSPredicate's MATCHES comparison method on the file's path relative to the directory being indexed. The default patterns to index are ".htm" and ".html". If these defaults are undesirable, you may use -e above to exclude them. This option can be passed as many times as necessary, once per pattern. -m, --min-term-length=NUM Minimum term length. Can be 1, 2 or 3. This is the number of consecutive tokens (typically a character) required for a term not to be ignored by the indexer. Recommended values are 3 for English and 1 for Chinese and other ideographic languages. -s, --stopwords=LANG|PATH Use stopwords. If you have your own stopwords .plist, provide that path. Otherwise, pass the two-character language code: en English es Spanish de German fr French hu Hungarian it Italian sv Swedish -r, --remote-url=URL Include a remote URL with the index. This is only useful in Type 1 or Type 2 help books, because the URL is in the help bundle's Info.plist for Type 3 books. The URL should be fully qualified, for example: -l, --locale=LANG Index for a specific locale. Instead of having to boot into the locale to index, pass the language code or locale identifier here to index for that language. Example locale identifiers: en_US US English es_ES Spanish de German fr French hu Hungarian ru_RU Russian https://www.mycompany.com/help_v1/ FILES
/usr/share/hiutil/Stopwords.plist List of default stopwords in different languages EXAMPLES
Here's what you'll mostly use this tool for, creating a help index: hiutil -Caf /tmp/myhelp.helpindex myHelpDirectory And if you then want to make sure that worked as expected: hiutil -Af /tmp/myhelp.helpindex Here's how to index .xml files as well, while ignoring everything in the idx directory in the root of your help folder: hiutil -Caf /tmp/help.helpindex -i ".*.xml$" -e "idx/.*" myhelpdir NOTES
hiutil requires Mac OS X 10.6 or greater. Darwin June 2, 2019 Darwin
All times are GMT -4. The time now is 12:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy