Search

bash split string every n characters

bash split string every n characters
Today I needed to split a string in bash every 5 characters. Here is how I did it: a="AdmitAfritAmbitAuditAwaitBefitBinitBruitCubitDavitDebitDemitDigitDixitDroitFixitFruitHabitKraitLegitLicitLimitMeritOrbitPetitPewitPipitPlaitPositQubitQuoitRecitRefitRelitRemitResitSpaitSplitSpritTacitTraitUnfitUnlitUnwitUplitVisitVomitZizit" count=5 # change 5 to however many characters you wish to break on b="$a" while ; do echo "${b:0:$count}" b="${b:$count}" done I hope this snippet helps somebody. If it does, please feel free to leave a comment... Read More

arduino pachube.com / cosm.com multiple data sources howto

arduino pachube.com / cosm.com multiple data sources howto
CSV Parser Error: CSV is invalid. Incorrect number of fields. I am playing with my arduino at the moment, datalogging to cosm.com (formerly pachube.com). I had issues with the csv line, it should be of the format: label1,value1\n label2,value2\n label3,value3 Mine was in the format label1,value1,label2,value2,label3,value3 The below code works for me, but that is because I have an LCD... Read More

pic32, Programming… boot config memory Address: ffffffff Expected Value: 0 Received Value: 0 Failed to program device

pic32, Programming… boot config memory Address: ffffffff Expected Value: 0 Received Value: 0 Failed to program device
I have been trying to reflash my corrupted PIC32 (specifically a pinguino32-usb-otg board) using MPlabX IDE and a Pickit 3. My connection was: PC to pickit 3 via USB pickit 3 to PIC32 via 6 pin header I tried to flash the chip but got the following error: Programming... boot config memory Address: ffffffff Expected Value: 0 Received Value: 0... Read More