Entries tagged as Unix/Shell
Related tags
Mar 18: Paste
[As part of the occasional series on small but useful Unix commands ...]
I've always loved Unix and vi and despair at those who prefer to faff around on Windows trying to edit files with an operating system and editors that, yes, are much more friendly but are hopelessly limited. The advent of Google (and yes, I'm more than aware of previous search engines) has added to the Unix/vi combination when I desperately need to solve a text processing problem in a hurry. I'm no awk expert!
Last Friday was one of those desperate moments. I was in the midst of an environment refresh and was rolling the test database forward using the Production control file. Each time I got a new copy of the control file to roll forward a bit more (because we use the control file as the RMAN repository), I wanted to rename the 170+ datafiles that make up the database. I had an ordered list of test and production files and their respective paths, but in two seperate files. All I wanted was to mingle the lines from each file into one file, with the two filenames on a single line.
I won't go into the details and I definitely won't get into extended dialogues about alternative solutions and why they didn't apply here*. This is a simple blog about the Unix paste command, which came to my rescue. (That link is to the very first Google result - no research or careful review.)
* No doubt those conversations will crop up, but I'm in course slide hell at the moment so don't expect much response from me.
I've always loved Unix and vi and despair at those who prefer to faff around on Windows trying to edit files with an operating system and editors that, yes, are much more friendly but are hopelessly limited. The advent of Google (and yes, I'm more than aware of previous search engines) has added to the Unix/vi combination when I desperately need to solve a text processing problem in a hurry. I'm no awk expert!
Last Friday was one of those desperate moments. I was in the midst of an environment refresh and was rolling the test database forward using the Production control file. Each time I got a new copy of the control file to roll forward a bit more (because we use the control file as the RMAN repository), I wanted to rename the 170+ datafiles that make up the database. I had an ordered list of test and production files and their respective paths, but in two seperate files. All I wanted was to mingle the lines from each file into one file, with the two filenames on a single line.
I won't go into the details and I definitely won't get into extended dialogues about alternative solutions and why they didn't apply here*. This is a simple blog about the Unix paste command, which came to my rescue. (That link is to the very first Google result - no research or careful review.)
* No doubt those conversations will crop up, but I'm in course slide hell at the moment so don't expect much response from me.
Oct 28: Script
Well, as the which blog was deemed useful (although most commentors did already know about it), how about the script Unix command?
It's very useful for keeping a record of an extended series of actions, like those a DBA will often encounter when implementing a complex change. It's also useful for attaching a complex working example to a Service Request to illustrate a problem. (That was the example that cropped up the other day that prompted this blog.)
It's very useful for keeping a record of an extended series of actions, like those a DBA will often encounter when implementing a complex change. It's also useful for attaching a complex working example to a Service Request to illustrate a problem. (That was the example that cropped up the other day that prompted this blog.)
Oct 25: Which?
No, I don't mean the UK consumer organisation, but a simple *nix command. It's so simple that I've hesitated about blogging about it, but when I keep sharing a small snippet of information and people don't know it and find it useful, it's probably worth mentioning here.
If you work on Unix servers, you'll be familiar with long $PATH settings. Sometimes it's difficult to tell which particular version of a command you're using when there are versions scattered around in various locations, some in the PATH and some not. If you want to check which copy of a command you're running, just use the which command. For example, in this PATH (which is pretty short compared to the PATHs on the servers at work)
I apologise to those for whom this is completely obvious, but there are clearly people out there who don't know this command and I find it useful regularly.
If you work on Unix servers, you'll be familiar with long $PATH settings. Sometimes it's difficult to tell which particular version of a command you're using when there are versions scattered around in various locations, some in the PATH and some not. If you want to check which copy of a command you're running, just use the which command. For example, in this PATH (which is pretty short compared to the PATHs on the servers at work)
[oracle@ISP4400 ~]$ echo $PATH /usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/oracle/bin: /u01/app/oracle/product/11.1.0/db_1/bin
if I type in
[oracle@ISP4400 ~]$ java
where is the executable running from? Well, I can check with the which command
[oracle@ISP4400 ~]$ which java /usr/bin/java
I apologise to those for whom this is completely obvious, but there are clearly people out there who don't know this command and I find it useful regularly.
« previous page
(Page 1 of 1, totaling 3 entries)
next page »


Comments