seq: Count up, count down

A quick note before we get into seq today: If you left a comment in the past 18 hours or so but don’t see it by now, it might have gotten lost in a spam avalanche.

Someone out there in the world must have turned up the dial on the spam machine, because I had more than 120 spam comments between noon today and early yesterday evening. For reference, I usually see 10 or 12 in a day.

Usually WordPress.com — in spite of all my complaints — does a decent job of filtering out the winners from the losers, but sometimes people get lost in the fracas. If for some reason your comment got mixed in with the spam, I’m sorry, but it’s likely gone forever.

And just FYI: If you include a URL in your comment, it’s more likely to be flagged as dubious by the automated system. Sometimes I can pluck a comment out while it’s circling the drain, but this time there were too many to scan through. My apologies.

Anyways. … seq is up to bat today, and this won’t take long. seq doesn’t do much other than count, by increment, between a stop and a start number. Sounds simple enough.

2014-08-26-6m47421-seq

The fun in seq is getting it to pad its output with leading zeros, which pleases people like me who want their numbered files to line up vertically down the screen. 🙄 And as you can see, you can set a delimiter for seq, which comes in handy at times.

It does pad things a little oddly at times — for example, that 00.0 in the screenshot above. And if you pad your numbers while counting in reverse (yes, you can do that), you’ll find that seq pads 0 as 00, and so forth. I should also mention that seq‘s last output doesn’t carry a separator. That means if you do something funky like this:

kmandla@6m47421: ~$ seq -w -s' '$(shuf -n1 /usr/share/dict/cracklib-small)$'\n' 1 1 10

You’ll see that every line but the last carries a random word. Just so you’re aware. 😉 Things like that are a little unusual but not deal-breakers. Not like join was. 😐

That’s about all I need to say about seq. It comes in very handy at times, which is probably why it’s part of coreutils. 😉

Advertisements

One thought on “seq: Count up, count down

  1. Pingback: Links 27/8/2014: GNU/Linux in Space, China, LinuxCon | Techrights

Comments are closed.