Mudar charset e quebra de linha recursivamente no Linux

26 Feb

Sometime ago I have to change the charset and line breaks of a web application from charset iso-8859-1 (US-Latin) to UTF-8 and linux break lines to windows break lines. At that time chronos helped to create this small script that I’m sharing now:

#!/bin/sh
#change extensions filter as you need 😉
find -type f | egrep ".php|.css|.js|.html|.htm" | egrep -v ".svn" > ./charset_list.txt;
while read -r line;do
	#charset change
	iconv -f LATIN1 -t UTF-8 "$line" > "${line}2";
	mv "${line}2" "$line";
	#we adopted dos format for line breaks
	unix2dos "${line}";
done < ./charset_list.txt > ./charset_after.log 2>&1 #receive list of params and send output to log

Explanationss: The script generate a list with files in actual and subfolders (according to the filter described in 2nd line).

After that reads the file, create a UTF-8 version of it in another file and move it over the old one, after this it changes the final file line breaks. Very simple, I LOVE BASH!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

15 Responses to “Mudar charset e quebra de linha recursivamente no Linux”

  1. ADS1SPrice December 19, 2013 at %I:%M %p #

    four-sensor antilock brakes with electronic brake force distribution (EBD). Kia says the EBD system adapts to individual wheel grip conditions to help improve the minivan’s control and stability.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  2. Aaron Kiphart November 16, 2013 at %I:%M %p #

    Wow, wonderful blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is great, let alone the content!. Thanks For Your article about Mudar charset e quebra de linha recursivamente no Linux | Dev With Passion .

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  3. baju bayi April 24, 2012 at %I:%M %p #

    Hey There. I found your blog using msn. This is a really well written article. I will make sure to bookmark it and return to read more of Mudar charset e quebra de linha recursivamente no Linux | Dev With Passion . Thanks for the post. I will definitely comeback.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  4. Marlboro cigarette April 19, 2012 at %I:%M %p #

    Our store delivers you the Parliament king size cigarettes, Parliament mild/blue cigarettes, Parliament 100’s cigarettes and Parliament 100’s mild/blue cigarettes. Cheap Parliament Silver cigarettes.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  5. Vickey Skar April 19, 2012 at %I:%M %p #

    I really like what you’ve done with the thmeme but I was asking myself if you are the one that created it or you just bought it and customized it?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  6. wheres my water apk April 18, 2012 at %I:%M %p #

    I am not sure where you are getting your info, but great topic. I needs to spend some time learning more or understanding more. Thanks for magnificent information I was looking for this information for my mission.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  7. Soczewki Allegro April 11, 2012 at %I:%M %p #

    Attractive section of content. I just stumbled upon your website and in accession capital to assert that I get in fact enjoyed account your blog posts. Any way I will be subscribing to your feeds and even I achievement you access consistently rapidly.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  8. best cigarettes April 11, 2012 at %I:%M %p #

    Winston cig tastes very good like a cigarette need to. This is Winston’s superiority over "rival" cig makes.Discount Winston Lights blue cigarettes.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  9. Eulalia Labreche April 9, 2012 at %I:%M %p #

    Sorry for the huge review, but I’m really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it’s the right choice for you.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  10. sex April 6, 2012 at %I:%M %p #

    Congratulations on your site that is always open to innovation. Thank you Free Porn, porno, sex, xxx management rokettubee.us Thank youu videos

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  11. Dubstep DJ April 3, 2012 at %I:%M %p #

    My dance team coach is making us make a music video for a project and it has to tell a story and my group has a storyline but we don’t know what song it should go to The storyline is about a girl who wants to do her own dance thing but is forced to do ballet and in the end ends up doing her own thing without caring what people want her to do Anyone have song suggestions?

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  12. hguhf 'fo April 2, 2012 at %I:%M %p #

    I would like to thnkx for the efforts you have put in writing this site. I’m hoping the same high-grade web site post from you in the upcoming also. In fact your creative writing skills has encouraged me to get my own site now. Actually the blogging is spreading its wings fast. Your write up is a great example of it.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  13. Melissia Isabelle March 26, 2012 at %I:%M %p #

    I really like how you create as well as the theme on your blog, Did a person signal this yourself or was this made by an expert? I’m very very impressed.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  14. strategi belajar saham March 25, 2012 at %I:%M %p #

    I like this blog very much so much great information.

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
  15. Biuro Podrozy March 23, 2012 at %I:%M %p #

    Hey very cool web site!! Man .. Beautiful .. Amazing .. I’ll bookmark your site and take the feeds also…I’m happy to find numerous useful information here in the post, we need work out more techniques in this regard, thanks for sharing. . . . . .

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)

Leave a Reply