in reply to Re: AWK? Split one file in seperate files based on country
in thread AWK? Split one file in seperate files based on country

Hi, i'm trying to understand what you created and piece by piece i'm putting it together. But when i run it i get the following error.

utf8 "\xEB" does not map to Unicode at C:\bla\bla\bla line 9, <$IN> line XXXX.

So i'm guessing this has something to do with the encoding. I'm not sure what kind of encoding i use. Is there a way to look this up in my file? Or is it possible to remove the encoding part? , '<:encoding(utf-8)' so it will read it as a normal file perhaps? Because i didn't need it before.

@ BrowserUk / jwkrahn: i dont have enough experience to work with your answers i'm afraid

edit: When i remove the encoding part i get this: No such file or directory at Z:\Data-Content\Data\test\jan\ALL_DATA\ori.pl line 13, <$IN> line 50001. (line 50001 being the end of the input file). What am i doing wrong?

Replies are listed 'Best First'.
Re^3: AWK? Split one file in seperate files based on country
by choroba (Cardinal) on May 31, 2012 at 08:41 UTC
    Have you removed the : as well? The open should look like
    open my $IN, '<', '1.csv' or die $!;
      Haha it worked! Thx so much:D This explains a lot for me:) I do have one other question. The first field of the original file has the names of the columns, is it possible to apply this to the output files aswell? Or in other words, keep the first row in al output files.

      So the first row consist of: country_name;region;city;etc;etc;etc

        Sure. After opening the file, just print the header before you start printing the countries.