Tag Archives: concatenate

tac: Not tic- or -toe either

tac is a fairly simple command, straight out of coreutils, that does almost everything you would expect it to.

2014-05-16-6m47421-tac

And with that one simple screenshot, not only do you know exactly what tac does, but why it has that name and what the joke is.

tac does pretty much everything cat does, with some very small omissions. For example, if you ever find yourself relying on cat -n to see line number counts, you won’t get that with tac.

Then again, I can only imagine a few isolated circumstances where that might be useful. 😕

Having said that, I find myself running out of things to say about tac. Unless of course, you find tac test.txt | rev | tac | rev somehow amusing. 🙄

mp3wrap: What has been rent asunder shall be forged anew

Mentioning mp3splt before mp3wrap was putting things out of order, in a manner of speaking.

After all, mp3wrap bundles a series of mp3 files as a single, playable, continuous mp3 file, while retaining all the tag data. Magical.

2014-01-20-lv-r1fz6-mp3wrap

And of course, mp3splt reverses that action, like we talked about earlier today.

mp3wrap handles itself nicely, keeps flags to a minimum, gives you plenty of information while it’s working, and keeps the concatenated file around the same size as a compressed file of the same info.

I’m not sure why a wrapped mp3 file would be preferable to split singles, but that shouldn’t perplex me. To each his own.

But what will keep me awake tonight is the question … could I wrap several wrapped files, and retain the individual file information? Can I wrap every song in my collection? Is there a mega-mp3wrap solution to all my music backup needs?

The mind boggles. 😯

cwp: Not the feline, but with progress

I had a hard time finding cwp; for a while I thought it was KDE’s customizable weather plasmoid, but that didn’t sound quite right. 😐

Finally I pinned it down, on a list with lots of other nifty tools. cwp, as it turns out, stands for “concatenate with progress,” meaning it should perform the same duty as cat, but give you a little more information.

2013-09-28-v5-122p-cwp

Depending on the situation, cwp will either be very very useful, or completely irrelevant. In that screenshot above, two 512Mb files of random information are pushed into one in the same folder.

cwp is barely useful in this case, because it takes so little time to concatenate them.

On the other hand, network transfers or combinations of several files over slower arrangements might be more helpful. Slower transfers, larger files or more meticulous concatenations might need a little more feedback.

Either way, I really like cwp for the same reason I really like Advanced Copy. I admire the Unix philosophy and I understand the need for succinctness, but sometimes I just need a little more information. 😉

cat: No, not the feline

I’ll just mention coreutil’s cat very quickly, because it’s one of those omnipresent tools that everyone uses almost daily. I like to think it’s the first console tool people learn.

2013-09-14-v5-122p-cat

In spite of that, there are right ways and wrong ways to use it. The Internet is full of examples of misuses of cat, and what the right way should be.

cat really only does one thing: takes the contents of a file and directs it to the screen.

The beauty of it though, is when it’s used in combination with redirects, double redirects and so forth.

So it can function as a primitive copy tool, just by

cat oldtext.txt > newtext.txt

or tack one file on the end of another:

cat oldtext.txt >> newtext.txt

Dump text into a file from the keyboard with:

cat - > textfile.txt

The possibilities are endless, really. And maybe you didn’t know it, but cat does have a few flags you can use. Flag of the day is:

cat -n textfile.txt

which numbers the lines. Clever, eh?

If you want a better introduction, may I suggest this page, which has a quite a few nifty examples of what to do with cat.

Now then. Let’s move on, shall we?

P.S., rumor has it you can concatenate some audio or video files with cat. Who’d’ve thunk it?! :mrgreen: