Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word Post 302613793 by chicchan on Tuesday 27th of March 2012 10:22:51 PM
Old 03-27-2012
Data Find EXACT word in files, just the word: no prefix, no suffix, no 'similar', just the word

I have a file that has the words I want to find in other files (but lets say I just want to find my words in a single file). Those words are IDs, so if my word is ZZZ4, outputs like aaZZZ4, ZZZ4bb, aaZZZ4bb, ZZ4, ZZZ, ZyZ4, ZZZ4.8 (or anything like that) WON'T BE USEFUL.

I need the whole word (and the line where it is), but the exact word, nothing more and nothing less. The only thing that could be useful would be (ZZZ).

Of course, I need THE ENTIRE output line, so using grep -o, would not be useful either.

I've tried so many things. Nothing had worked fine.

-----

ok, lets say that my file that has the IDs is called 'Id', i've tried:


Code:
grep -wf Id file >> outputFile


If my first Id was 'Sun', the previous line gives me outputs like 'Sunny' (it also gives me 'Sun' as an output, that's ok). NOT GOOD!

I've tried several grep options. I've tried fgrep. Not good. I've tried agrep, and it's not good because it is approximate, so if I were looking for 'Sunny', agrep could throw 'Suny' as an output.

The things I've not tried much are things that involve regular expressions (too scared). Anyway, if I was trying to use regular expressions, how could I do that if the words I am searching are in a file called Id?

Smilie

Please help Smilie!
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

find a word in a file, and change a word beneath it ??

Hi all, I have a file with lines written somewhat like this. aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec (2 Replies)
Discussion started by: vikas027
2 Replies

3. Shell Programming and Scripting

Find Exact word in file

Hi ALL, I want to search one string “20 “ i.e 20 with space. But my file where I am searching this “20 “ contain some data like 120 before image file truncated 220 Reports section succeeded 20 Transaction database .prd stopped 220 Reports section completed. When I search for the... (5 Replies)
Discussion started by: Jeevan Salunke
5 Replies

4. UNIX for Dummies Questions & Answers

Script to search for a particular word in files and print the word and path name

Hi, i am new to unix shell scripting and i need a script which would search for a particular word in all the files present in a directory. The output should have the word and file path name. For example: "word" "path name". Thanks for the reply in adv,:) (3 Replies)
Discussion started by: virtual_45
3 Replies

5. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

6. Shell Programming and Scripting

Compare two files word by word

I need to compare two files word by word using unix shell scripting. Could someone help me? I need the code which will compare the 1st word from file1 with 1st word from file2, 2nd word from file1 with 2nd word from file2 etc..., for all the lines. Example: File1: aaa bbb ccc ... (7 Replies)
Discussion started by: rsmohankumar
7 Replies

7. Shell Programming and Scripting

perl lwp find word and print next word :)

hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this: I have in my response lines like: <div class="sender">mimi020</div> <some html code.....>... (3 Replies)
Discussion started by: vogueestylee
3 Replies

8. Shell Programming and Scripting

Shell Script @ Find a key word and If the key word matches then replace next 7 lines only

Hi All, I have a XML file which is looks like as below. <<please see the attachment >> <?xml version="1.0" encoding="UTF-8"?> <esites> <esite> <name>XXX.com</name> <storeId>10001</storeId> <module> ... (4 Replies)
Discussion started by: Rajeev_hbk
4 Replies

9. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

10. Shell Programming and Scripting

Find a word and increment the number in the word & save into new files

Hi All, I am looking for a perl/awk/sed command to auto-increment the numbers line in file, P1.tcl: run_build_model sparc_ifu_dec run_drc set_faults -model path_delay -atpg_effectiveness -fault_coverage add_delay_paths P1 set_atpg -abort_limit 1000 run_atpg -ndetects 1000 I would like... (6 Replies)
Discussion started by: jypark22
6 Replies
cs00toatok(1)							   User Commands						     cs00toatok(1)

NAME
cs00toatok - conversion cs00 user dictionary to ATOK user dictionary SYNOPSIS
cs00toatok [filename...] AVAILABILITY
SUNWjfpu DESCRIPTION
cs00toatok is a filter that converts cs00 word-list-file to ATOK word-list-file. cs00toatok is used for the purpose of using cs00 user words on ATOK12 as well as on cs00. cs00toatok reads file(s) specified by filename(s). If no filenames are given, cs00toatok reads a file from the standard input. The con- tents of the files must be the format of cs00 word-list-file. cs00toatok writes ATOK word-list-file to the standard output. cs00toatok con- verts each word according to the following rules. Kana reading (Phonetic), Kanji word Does not change any character and the length of Kana reading and Kanji word of each source word. Part-of-speech (Hinshi) Converts Hinshi of source word according to the table shown below. +--------------------------------------------------------------------------------------------------------+ |Part-of-speech in cs00 Part-of-speech in ATOK | | |:N1 noun1 | 01 common noun | |:N2 noun2 | 01 common noun | |:M1 person's name1 | 02 proper noun | |:M2 person's name2 | 02 proper noun | |:T1 place name1 | 02 proper noun | |:T2 place name2 | 02 proper noun | |:NM numeral | 13 numeral | |:NN supplemental numeral | 12 suffix | |:PR prefix | 11 prefix | |:SF suffix | 12 suffix | |:AD adverb | 29 adverb | |:CN conjunction | 09 conjunction | |:RT participial adjective | 08 participial adjective | |:AJ adjective | 27 adjective | |:AV adjective verb | 28 adjective verb | |:SH S-series irregular conjugation verb | 03 noun form of S-series irregu- | | | lar conjugation verb | |:ZH Z-series irregular conjugation verb | 04 noun form of Z-series irregu- | | | lar conjugation verb | |:1V single conjugation verb | 23 single conjugation verb | |:KV K-series five conjugation verb | 14 K-series five conjugation verb | |:GV G-series five conjugation verb | 15 G-series five conjugation verb | |:SV S-series five conjugation verb | 16 S-series five conjugation verb | |:TV T-series five conjugation verb | 17 T-series five conjugation verb | |:NV N-series five conjugation verb | 18 N-series five conjugation verb | |:BV B-series five conjugation verb | 19 B-series five conjugation verb | |:MV M-series five conjugation verb | 20 M-series five conjugation verb | |:RV R-series five conjugation verb | 21 R-series five conjugation verb | |:WV W-series five conjugation verb | 22 W-series five conjugation verb | |:UN no classification | - - | |:TK single kanji | 07 single kanji | |:BS clause | - - | +-------------------------------------------------------------+------------------------------------------+ Words with the part of speech "no classification" (:UN) or "clause" (:BS) need -a option to be put out. Also, a source word with multiple parts of speech is converted to plural words, each of which has the each part of speech. OPTIONS
-a Put out words whose part of speech are "no classification" or "clause" as words whose parts of speech are unknown, in addition to words put out by default. NOTES
cs00toatok does not change Kana reading and Kanji word of any word. Therefore, note below. o A word may not be registered to ATOK user dictionary with the characters or the length of kana reading and kanji word of the word. o If the edge of a word is `'' (Zenkaku single quote) or `"' (Zenkaku double quote), a new word stripped the edge of characters from the word is registered. o If Kanji word of a word contains `,' (Zenkaku comma), the word cannot be registered to ATOK user dictionary. Use ATOK12 dictionary utility to register a word-list-file to ATOK dictionary. For detail, refer to ATOK12 User's Guide. SEE ALSO
atok12(1), atok8wordlist(4) SunOS 5.10 10 Jan 2003 cs00toatok(1)
All times are GMT -4. The time now is 09:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy