Saturday, May 28, 2011

Combining Over a Hundred Text Files into One Text File

Or you could alternately title this entry:
What He Sed :-)

The kinds of things that I typically want to do aren't what most people would call normal. How many people that you know would ever come upon a situation where they would have three different directories which had more than sixty individual text files in each directory. And their end objective was to merge all of these text files into three different full text collections?

Copy/Paste you say?; or not for me. I just know enough to know that I can do it another way. A way that 'would' be easier and save time if I knew it off the top of my head. But 'no' I don't know it off the top of my head so I have to research it for five hours until I can get the right combination to get it done ... Would I have gone through with this if I had known it was going to take five hours? ... 'no' probably not.

But when you are in the midst of the problem, one hour into it, you think you are close enough to get it finished in another half hour. But then after ninety minutes you think "Well I already have an hour and a half into it and I'm so close so I might as well finish it.". And after three hours you say "I'm going to figure this out dag blame it!" :-)

Now the aforementioned merging of all of the text files in the same directory would have been easy enough. I was given a little help by a new facebook friend in the Philippines. And after a couple of tries we were able to conclude that cat * >> alltext.txt would do it for me.

However a few of the text files were crowded up a bit at the beginning and the end of them and I just need to add three or four blank lines to the bottom of each of the text files before merging them. Ok sound easy enough right? But really this is the part that took me most of that five hours ... So after several hours (excluding a couple of food breaks and a few breaks to give attention to my children) I searched a few dozen pages and read dozens of paragraphs.

I abandoned echo for a little while (a solution that had worked on a single file), went to sed (which I didn't know much about), went back to echo when sed looked too difficult, went back to sed after trying several things with echo that didn't work. Then looked over awk for a little while but thought that it was a whole different animal and went back to sed.

Does that sound convoluted enough? :-)

After several more tries I finally came up with the following line that I executed on my test directory and worked on three random files which I tested and have all turned out correctly.

sed -i '$ s/$/ \n\n\n\n\n\n/' *

whew !

Labels: , , ,

Friday, May 27, 2011

Adware and Malware Blocking Tip

Are you a windows use? ... Well then you'll want to pay attention to this.

There are a lot of adware and malicious programs that are out there which the average windows user just doesn't have the time to learn about. And although lots of tech people are always telling you ways of conducting yourself on the Internet that will save you grief, I'm sure you've admitted to yourself that you just don't have the time to think about all of this.

Ok, so here is the answer that you don't have to do but one time and it gives you a layer of protection you don't have to think about. Best of all it costs you nothing because it's built into windows.

Click here, to download a host file to replace your current one. However if you don't know what a host file is and need some more help, just make a comment on this article and I'll talk you through it in a way that will help you and other readers as well. There is also a link here that is probably a LOT more detailed than most people want to get through; but useful if you can get through it.

Well, I haven't tried this on Linux yet but then again I haven't had any need to. I have a windows computer on our little network at home so it crossed my mind to block a few unwanted things that might come in on that computer. And on an additional tip, you 'can' use this with Mac (if needed).

Labels: , ,

Friday, May 20, 2011

Help My Roommate Uses All of My Bandwidth!

I could have titled this little gem with "Brother", "Cousin", "Son", or any number of family members but I thought that Roommate would be shorter than trying to include every family member in the title of this ... I haven't had to do this before but I've gotten really close on a couple of occasions. I started to write this as a comment on a friend's blog but it got too involved.

He, like many people, have run into the situation where one person on their home network (usually not so tech savvy) is doing something like gaming, watching movies online, or file sharing, that is sucking up lots of bandwidth and said person doesn't realize how inconsiderate that is for those of us trying to get some real work done.

There is a solution but it's not for the non-techy because this 'could' mess up (called bricking) your router. But I've flashed everything from old external modems to pentium computers. So, if you have any related body of experience to pull from you should be able to do this as well.

If you'd like to have the option of either beefing up your bandwidth or segmenting only a certain portion of your bandwidth you could buy the Linksys WRT54GL and then setup QOS where you can Prioritize the bandwidth by MAC Address. Once you flash your router there really is a LOT more that you can do with this than I could easily cover in a quicky article like this. But this is one sort of home network traffic shaping that would be an option.

There is also more than one option for the WRT54GL firmware. I've read the most about Tomato firmware and DD-WRT. You'd have to go through the features and functionality of those two to see what you'd want ... If you've never done anything like this before, it sounds harder than it is. It's just "a bit different" from what many people are used to. But if you've flashed a BIOS before you should be able to handle this without a problem.

Labels: , , ,

Monday, May 16, 2011

Adobe Flash for Ubuntu

Adobe hasn't been known for it's cooperation with the variation development organizations it is supposed to be working with. And as a result of that a few things can be a bit challenging in the Windows world and 'even more' challenging in the OpenSource world.

So, you might also have trouble with the Adobe Flash installation for Ubuntu. If so just install the Flash-Aid extension for Firefox! Worked for me and I'm running Ubuntu Lucid 10.04 (and Firefox 3.6.3).

And as an additional benefit the extension auto-checks the recent development version (you can change this in the plugin configuration) so you will always have the most recent version.

Labels: , , , , ,