Base conversions with bc

echo "obase=2; 27" | bc -l
Easily convert numbers to their representations in different bases. Passing "ibase=16; obase=8; F2A" to bc will convert F2A (3882 in decimal) from Hex to Octal, and so on.
Sample Output
```\$ echo "obase=2; 27" | bc -l
11011
\$ echo "ibase=16; F2A" | bc -l
3882
\$ echo "ibase=16; obase=8; F2A" | bc -l
7452```

20
2009-03-25 09:54:50

What Others Think

seems to me that this doesn't work all the time: This is correct: `echo "ibase=2; obase=4; 01100001"|bc -l` `1201` But the following aren't: This one outputs the answer in base 3, not base 16: `echo "ibase=2; obase=16; 01100001"|bc -l` `10121` This one doesn't do any conversion at all: `echo "ibase=2; obase=10; 01100001"|bc -l` `1100001` and here's a workaround that seems to do what it should, with the added benefit of being able to supply the number on stdin: `echo "obase=16;\$(echo "ibase=2;\$(head -n 1)"|bc)"|bc`
camocrazed · 739 weeks and 1 day ago
I stand corrected. Setting the ibase changes it for all the following numbers, including the one supplied to obase, but only for multi-digit numbers. A better workaround to this than my previous one is to simply put obase first `"obase=16; ibase=2; 01100001"|bc -l` `61`
camocrazed · 739 weeks ago
Since 2008, Perfect House Pug Puppies has been the leading Pug puppy breeder in the US, providing premium Pug puppies for sale. Each puppy exhibits the professionalism and knowledge that have set Perfect House Pug puppies apart from other pug puppy breeders. The professionals at Perfect House Pug Puppies are dedicated about finding their puppies loving, beloved homes where they can enjoy long, healthy lives. A companion that has been produced for quality, health, and temperament that satisfies the breed standard is guaranteed by Perfect House Pug puppies, the pug breeder that has set the benchmark for exceptional customer satisfaction. If you are looking to buy a baby pug, Black and white pugs, Mini pug puppies for sale, Black and tan pug for sale, Teacup pug puppies for sale, Female pug puppies, pug puppies for sale, pug puppies for sale near me, pug puppies for sale under \$500 near me. Pug Puppies for Sale Near Me pugs puppies for sale teacup pugs for sale pug puppies for sale by owner pug puppies ohio PUG PUPPY FOR SALE NEAR ME PUG PUPPIES FOR SALE pug puppies for sale in kentucky Pug Puppies for Sale Under \$500 Near Me pug puppies for sale in texas pug puppies for sale \$200 pugs for sale near me under \$500 pugs for sale under \$400 near me pugs for sale near me puppies for sale near me under \$500 pug puppies for sale under \$1,000 near me pug for sale pug puppies for sale under \$300 Brindle Pug Pitbull Pug Mix Pugs for sale cheap Cheap pug affordable pug puppies for sale near me black pugs for sale near me White Pugs for sale pug dog for sale free pug puppies pug puppies for sale in my area mn pug breeders pug puppies indiana pugs for sale michigan PUG PUPPY ADOPTION Pug puppies for sale Pug puppies for sale near me Pug puppies near me Pug Puppies for Sale Under \$500 Near Me Cute Pug Puppies Black pug puppies Black pug puppies for sale pug puppies for adoption black pug puppies for sale near me chihuahua pug mix puppies how much is a pug puppy teacup pug puppies baby pug puppies baby pug puppies for sale pictures of pug puppies pug puppies for sale in Ohio pug puppies price pug mix puppies teacup pug puppies for sale best food for pug puppy newborn pug puppies pug puppies craigslist pug puppies for sale craigslist adorable pug puppies how much does a pug puppy cost Pitbull pug mix puppies pug pit mix puppy pug puppies for sale \$200 pug puppies for sale in NJ Pug puppies for sale in Wisconsin pug puppy cost pug puppy food royal canin pug puppy royal canin pug puppy food fawn pug puppy pug puppies for sale florida pug puppies for sale in Indiana pug puppies for sale in KY pug puppies for sale in NC pug dog puppy AKC Registered Pug Puppies For sale cheap pug puppies for sale near me cheap pug puppies for sale in California cheap pug puppies for sale in nj Black Pug Puppies for sale pugs puppies for sale
Perfecthomepugs · 97 weeks and 2 days ago
First You got a great blog .I will be interested in more similar topics. i see you got really very useful topics, i will be always checking your blog thanks. TrafficForMe Review
seomind · 92 weeks and 2 days ago
Hi to everybody, here everyone is sharing such knowledge, so it’s fastidious to see this site, and I used to visit this blog daily TrafficForMe Review
seomind · 92 weeks and 2 days ago
I don’t think many of websites provide this type of information. TrafficForMe Review
seomind · 92 weeks and 2 days ago
Mmm.. good to be here in your article or post, whatever, I think I should also work hard for my own website like I see some good and updated working in your site. Allysian Sciences Review
seomind · 92 weeks and 2 days ago
This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information... Best Affiliate Networks
seomind · 92 weeks and 2 days ago
I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Best Affiliate Networks
seomind · 92 weeks and 2 days ago
This post is good enough to make somebody understand this amazing thing, and I’m sure everyone will appreciate this interesting things. Best Affiliate Networks
seomind · 92 weeks and 2 days ago
Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. SEO Blueprint 2
seomind · 92 weeks and 2 days ago
seomind · 92 weeks and 2 days ago
I really thank you for the valuable info on this great subject and look forward to more great posts SEO Blueprint 2
seomind · 92 weeks and 2 days ago
Buy Chronic Pain Pills Online Without Medical Card ADHD Meds Without Prescription USA\ UK Anti Anxiety Medications For Sale USA Weight Loss Drugs For Sale Without Prescription Psychedelic For Sale Discreet Delivery Where To Buy Research Chemicals Online https://naturaldrugsstoreonline.com/ https://naturaldrugsstoreonline.com/product-category/pain-medication/ https://naturaldrugsstoreonline.com/product-category/adhd/ https://naturaldrugsstoreonline.com/product-category/anti-anxiety/ https://naturaldrugsstoreonline.com/product-category/weight-loss/ https://naturaldrugsstoreonline.com/product-category/psychedelic/ https://naturaldrugsstoreonline.com/product-category/research-chemicals/ https://naturaldrugsstoreonline.com/product/fentanyl-powder/ https://naturaldrugsstoreonline.com/product/dmt/ https://naturaldrugsstoreonline.com/product/dmt-vape-pen/ https://naturaldrugsstoreonline.com/product/5-meo-dmt/ https://naturaldrugsstoreonline.com/product/reductil-15mg-sibutramine/ https://naturaldrugsstoreonline.com/product/phentermine-37-5mg-suprenza/ https://naturaldrugsstoreonline.com/product/valium-10mg-for-sale/ https://naturaldrugsstoreonline.com/product/xanax-3mg/ https://naturaldrugsstoreonline.com/product/modafinil-modalert-200mg/ https://naturaldrugsstoreonline.com/product/adderall/ https://naturaldrugsstoreonline.com/product/oxycodone-30mg/ https://naturaldrugsstoreonline.com/product/fentanyl-pills/
jnmedshouse22 · 76 weeks and 1 day ago
Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post . Cory Long
seomind · 67 weeks ago
Thanks for providing recent updates regarding the concern, I look forward to read more. Cory Long
seomind · 67 weeks ago
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one. Cory Long
seomind · 67 weeks ago
I curious more interest in some of them hope you will give more information on this topics in your next articles. Cory Long
seomind · 67 weeks ago
Wow! Such an amazing and helpful post this is. I really really love it. It's so good and so awesome. I am just amazed. I hope that you continue to do your work like this in the future also. Cory Long
seomind · 67 weeks ago
Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post. Cory Long
seomind · 67 weeks ago
I read that Post and got it fine and informative. Please share more like that... Cory Long
seomind · 67 weeks ago
seomind · 67 weeks ago
I really enjoyed reading this post, big fan. Keep up the good work andplease tell me when can you publish more articles or where can I read more on the subject? Cory Long
seomind · 67 weeks ago
I liked your article and I hope you will have many entries or more Cory Long
seomind · 67 weeks ago
pugpuppies95 · 59 weeks and 2 days ago
SHIBATOTO adalah situs slot gacor yang merupakan situs slot online gacor , terbaik dan terpercaya gampang menang maxwin dengan metode deposit terlengkap. Dengan Promo Garansi Kekalahan 100% , dan Masih banyak Promo Terbaik Lainnya , Buruan Daftar Sekarang Juga Hanya di SHIBATOTO
KarinTaufik12 · 36 weeks and 1 day ago
SHIBATOTO adalah situs slot gacor yang merupakan situs slot online gacor , terbaik dan terpercaya gampang menang maxwin dengan metode deposit terlengkap. Dengan Promo Garansi Kekalahan 100% , dan Masih banyak Promo Terbaik Lainnya , Buruan Daftar Sekarang Juga Hanya di SHIBATOTO
rina · 36 weeks and 1 day ago
SHIBATOTO adalah situs slot gacor yang merupakan situs slot online gacor , terbaik dan terpercaya gampang menang maxwin dengan metode deposit terlengkap. Dengan Promo Garansi Kekalahan 100% , dan Masih banyak Promo Terbaik Lainnya , Buruan Daftar Sekarang Juga Hanya di SHIBATOTO
oladewi · 36 weeks and 1 day ago
I think this is a standout amongst the most critical data for me. What"s more, i"m happy perusing your article. Be that as it may, ought to comment on some broad things. emperor33
fodev71992 · 31 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.