Help to identify blank space in a file

Hello,
I have a dictionary of over 400,000 words with the following structure

source=target

The database contains single words as well as phrases. To train the data, I need only mappings with out a space i.e. where both source and target do not have any space in between.
I use Ultraedit as my editor and have been using the following regex in Unix to identify a blank space

^[^ ]+$

Since the database is too large, the editor runs out of memory and cannot store all instances to the clipboard.
Am giving below a small sample text

= 
=
=/ 
=
= 
= 
= 
= 
=
=
= 
= 
=
= 
=
=
= 
= 

The script should identify only those entries without a space on either side and store them in a separate file, as in the sample output below

=
=
=
=
=
=
=

A perl or awk script would help. I work in a windows environment.
Many thanks.

Have a look at the -v option of grep:

grep -vF ' ' your_file

True. Still, as a measure of safety i would rule out trailing or leading spaces:

sed -n '/^[[:blank]]*//;s/[[:blank:]]*$//;/ /!p' > /result/file

I hope this helps.

bakunin

1 Like

For instance using grep:

grep -v '[^ ] [^ ]' your_file
1 Like

Many thanks for all your kind help. My broadband connectivity was down all day and hence the delay. All the solutions worked. I had ensured that my data had no trailing spaces so the issue of trailing spaces does not arise but is is nice to have a solution which ensures that trailing spaces are handled.
Thanks once again.