GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How to cat countryInfo.txt | grep -v "^#" >countryInfo-n.txt in windows  XML
Forum Index -> General
Author Message
chandu2708



Joined: 30/08/2009 08:25:09
Messages: 8
Offline

Hi There,

Did any one tried similar stuff. if so please share the details.

Thank you,
bala.
fred_kuijper



Joined: 24/01/2008 22:08:39
Messages: 35
Location: The Netherlands
Offline

Hi Bala,

Maybe you should explain to window users that you want countryinfo.txt without comment lines. Isn't there a grep for windows, btw?

Fred.

Fred Kuijper
The Netherlands
chandu2708



Joined: 30/08/2009 08:25:09
Messages: 8
Offline

Hi Fred,

Thx for the reply. i dont think there is a grep option availabel in Windows. there are some programs i can use which stimulates the grep command but that setp is a bit complex.

Thank you,
bala.
chandu2708



Joined: 30/08/2009 08:25:09
Messages: 8
Offline

I downloaded cgwin. not things are fine. thx for the help.
cancausecancer



Joined: 11/09/2009 11:12:34
Messages: 4
Offline

You don't need to execute that cat | grep on Windows.

What the command does is go thru countryInfo.txt and copy each line into countryInfo-n.txt with the exception of lines which start with #. So it is just removing the comment lines. You can do this manually in a text editor.

If you want a break down of what is happening, cat is outputting the text file,
^# means 'where first character is #'
-v means 'do opposite'
grep is searching,
> countryInfo-n.txt means pipe the output into a file

So in affect, its listing the file, searching for lines not starting with # and outputting them into another text file.
fred_kuijper



Joined: 24/01/2008 22:08:39
Messages: 35
Location: The Netherlands
Offline

Hi Bala,

I think that you should try something like this: http://gnuwin32.sourceforge.net/packages/grep.htm

I can't test it since I no longer run Windows but it looks good to me.

Fred Kuijper
The Netherlands
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team