I will only take a few moments to show what
cut can do. Another gem from the coreutils package,
cut … well,
cut … cuts apart text. 🙄
So here’s an idea for you: Let’s imagine that you’re a bit obsessive like me, and you want to inject the file creation date of a video file into its filename.
Yeah, I know. It’s odd. 😳
I can extract that information with mediainfo. I can filter out the “Encoded date” with grep, but I still have a line of data that looks like this.
Encoded date : UTC 2013-09-22 04:32:37
Now I need to carve out the date and time so they can be pushed into the file name. That’s where
cut comes in.
cut, I can select specific character counts, certain delimiters, or just about anything else, and get back the string of data I want. So …
-c flag means cut at characters. The
48 means the 48th character in line. And the final hyphen means continue to the end of the stream. And what do I get in reply?
Nice and pretty.
That’s just one oddball example; there are pages and pages around the Internet that can coach you through
cut. Not to play favorites, but here’s one that might help you get started.
P.S.: Why such an obtuse example? Because I just needed
cut for that very thing, only three days before I wrote this post. … 🙄
Pingback: info: More information, sometimes | Inconsolation
Pingback: mediainfo: There is none higher | Inconsolation
Pingback: basename: What I had in mind | Inconsolation
Pingback: Tricks of the trade | Motho ke motho ka botho
Pingback: genstats: Quick statistical reports | Inconsolation
Pingback: genstats: Quick statistical reports | Linux Admins