Register
It is currently Sun Apr 22, 2018 9:51 pm

using cat grep to create dummydata iso-8859-15


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed Apr 26, 2017 2:13 pm   

Joined: Fri Jan 01, 2016 2:56 am
Posts: 3
Hi I'm having problem to produce dummydata for external developers...
My OS is ubunutu 16.04 LTS.
My bash-version therefore is 4.3-14ubuntu1
My grep-version is 2.25-1~16.04.1

I want to grep strings in a 367MB-file and pipe them into another file without changing the character set.
so the old and the new file should be iso-8859-15.

My idea was
cat sourcefile.TXT |grep -a --text 'string1' > /path/to/destinationfile.TXT
cat sourcefile.TXT |grep -a --text 'string2' >> /path/to/destinationfile.TXT
cat sourcefile.TXT |grep -a --text 'string3' >> /path/to/destinationfile.TXT
But of course the new file is UTF8 and special characters like äöüß and so on are not readable anymore.

Any ideas? Thank you for your thoughts. With kind regards

Hans


Top
 Profile  
 PostPosted: Mon May 01, 2017 8:45 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
All linuces deploy UTF-8.

Hence read the files with iconv.
and read about iconv

Another way of doing this, is to use the LANG=en_US.latinwhatever vars.
But you have to install these locales first.

btw. To not use UTF-8 is digital stone-age.
Avoid it.
It is always better to convert all files and programs to UFT-8


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP