Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Unexpected Behaviour from grepping Text File Post 302650413 by sudon't on Saturday 2nd of June 2012 08:49:58 PM
Old 06-02-2012
Unexpected Behaviour from grepping Text File

Hi!
I recently downloaded a wordlist file called 2of12.txt, which is a wordlist of common words, part of the 12dicts package. I've been getting unexpected results from grepping it, such as getting no matches when clearly there ought to be, or returns that are simply wrong.
Par exemple:

Code:
egrep ^...a.....n.$ /usr/share/dict/2of12.txt |head -5

apparition
bipartisan
cavalryman
defamation
dilatation

Clearly I'm asking for an eleven-letter word, and getting ten-letter words, (but at least the letters I'm asking for are in the right places). If I grep any other wordlist, I get the expected results.

Code:
egrep ^...a.....n.$ /usr/share/dict/sowpods.txt |head -5

advancement
advantaging
alkalescent
alkalifying
antalkaline

But if I add an extra dot at the end, I get the correct results. Well, not the correct results, but you know what I mean:

Code:
egrep ^...a.....n..$ /usr/share/dict/2of12.txt |head -5

advancement
arraignment
arrangement
derangement
devastating

I opened 2of12.txt in TextWrangler, showing invisibles, to see if there were some kind of extra white space characters in there, but I could see nothing wrong. It looks like they're all single words, followed by a newline.
Something must be wrong with this file, but I have no idea what it might be. I had read here 12dicts - Helpful that the file contained annotations after certain words, but I can find none of these. Does anyone have any idea what might cause this behaviour in a text file? If so, how can I find and fix this problem?
Thanks!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grepping Errors in a file

Hey All, I have to grep for an error from a file and get the results of errror in a different file...... But there should be no duplicate entries. Can anyone help me in giving a shell script for this This is file which contains pattern error which I am supposed to grep and put this in a... (4 Replies)
Discussion started by: achararun
4 Replies

2. Shell Programming and Scripting

Grepping text by providing line numbers.

Dear Friends, I have a flat file from which I want to grep line no. 7,10, 19 to 35, 37. How can it be done? Thank you in advance Anushree (6 Replies)
Discussion started by: anushree.a
6 Replies

3. Shell Programming and Scripting

Grepping log file

Dear All, I have a log file that is dislpayed as: <msg time='2009-10-14T05:46:42.580+00:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='mtdb_a' host_addr='UNKNOWN' version='1'> <txt>14-OCT-2009 05:46:42 *... (19 Replies)
Discussion started by: x-plicit78
19 Replies

4. Shell Programming and Scripting

Grepping file and returning passed variable if the value does not exist in file at all.

I have a list of fields that I want to check a file for, returning that field if it not found at all in the file. Is there a way to do a grep -lc and return the passed variable too rather then just the count? I am doing some crappy work-around now but I was not sure how to regrep this for :0 so... (3 Replies)
Discussion started by: personalt
3 Replies

5. AIX

Unexpected Behaviour with WPAR

Hello, We have a system running AIX 6.1.7.1. We have created a Workload Partition(wpar) on this system with wpar specific routing enabled. On wpar, we are running DNS (UDP/53) and syslog (UDP/514). en0: 1.1.1.1/255.255.255.0 NOT assigned to any wpar en1:... (0 Replies)
Discussion started by: 03sep2011
0 Replies

6. UNIX for Dummies Questions & Answers

mtime unexpected behaviour

Hi All, My requirement is to remove the more than 60 days files from Archive folder, so prepared this command. for files in `find /abc/Archive/<file_name_25032012.dat> -type f -mtime 61|xargs ls -lrt` do rm -f $files done I tested this command in both unix and informatica. In unix if files... (8 Replies)
Discussion started by: harris
8 Replies

7. Shell Programming and Scripting

Help with grepping data from a text file

Hello, I have a text file which contains a list of strings which I want to grep from another file where these strings occur and print out only these lines. I had earlier used the grep command where File1 was the file containing the strings to be grepped (Source File) and File2 the Target File... (4 Replies)
Discussion started by: gimley
4 Replies

8. Shell Programming and Scripting

Grepping text from one file in another file

Hello, I have a file with a large number of words each listed in sequential order one word per line. I want to search these words in another file which has the structure Both the files are large, but the words in the sourcefile are all available in the target file. I tried to grep... (2 Replies)
Discussion started by: gimley
2 Replies

9. UNIX for Advanced & Expert Users

[BASH] Getopts/shift within a function, unexpected behaviour

Hello Gurus :) I'm "currently" (for the last ~2weeks) writing a script to build ffmpeg with some features from scratch. This said, there are quite a few features, libs, to be downloaded, compiled and installed, so figured, writing functions for some default tasks might help. Specialy since... (3 Replies)
Discussion started by: sea
3 Replies

10. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies
WORD-LIST-COMPRESS(1)					 Aspell Abbreviated User's Manual				     WORD-LIST-COMPRESS(1)

NAME
word-list-compress - word list compressor/decompressor for GNU Aspell SYNOPSIS
word-list-compress c[ompress] | d[ecompress] DESCRIPTION
word-list-compress compresses or decompresses sorted word lists for use with the GNU Aspell spell checker. COMMANDS
-c, c, compress compress the plain text word list read from standard input. -d, d, decompress decompress the compressed word list read from standard input. EXAMPLES
Here are a few examples of how you can use word-list-compress word-list-compress d <wordlist.cwl >wordlist.txt Decompress file wordlist.cwl to text file wordlist.txt word-list-compress c <wordlist.wl >wordlist.cwl 2>errors.txt Compress wordlist.wl to wordlist.cwl and send any error messages to a text file named errors.txt LC_COLLATE=C sort -u <wordlist.txt | word-list-compress c >wordlist.cwl Sort a word list, then pipe it to word-list-compress to create a compressed binary wordlist.cwl file. word-list-compress d <words.cwl | aspell create master ./words.rws Decompress a wordlist, then pipe it to aspell(1) to create a spelling list. Please check the aspell(1) info manual for proper usage and options. TIPS
Word-list-compress is best used with sorted word list type files. It is not a general purpose compression program since the resulting files may actually increase in size. Word-list-compress accepts up to 255 text characters in the range of {0x21...0xFF}. If your word list requires a larger character set for certain languages or longer length for multi-word, scientific, medical, technical or other use, then it is recommended that you compress your word list using prezip-bin(1) DIAGNOSTICS
Word-list-compress normally exits with a return code of 0. If it encounters an error, a message is sent to standard error output (stderr), and word-list-compress exits with a non-zero return value. Error messages are listed below: (display help/usage message) Unknown command given on the command line so word-list-compress displays a usage message to standard error output. Corrupt Input This is only for the decompression command d. The input file is of an unknown format or the input file/stream is corrupted. You may have some valid output, but word-list-compress could not complete the process. If the input file is a compressed wordlist but you have no output file, then it may be a newer prezip-bin(1) version of compressed file, if so, try decompressing the file with prezip-bin(1) instead. Output Data Error The output is full, write protected, or has an error and can no longer be written to. SEE ALSO
aspell(1), aspell-import(1), prezip-bin(1), run-with-aspell(1) Aspell is fully documented in its Texinfo manual. See the `aspell' entry in info for more complete documentation. REPORTING BUGS
For help, see the Aspell homepage at <http://aspell.net> and send bug reports/comments to the Aspell user list at the above address. AUTHOR
This manual page was written by Aaron Lehmann <aaronl@vitelus.com>, Brian Nelson <pyro@debian.org> and Jose Da Silva <digital@joescat.com>. GNU
2005-09-05 WORD-LIST-COMPRESS(1)
All times are GMT -4. The time now is 04:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy