Paste

Doug's Oracle Blog

  • Home
  • Papers
  • Books
  • C.V.
  • Fun
  • Oracle Blog
  • Personal Blog

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.
Posted by Doug Burns Comments: (8) Trackbacks: (0)
Defined tags for this entry: Unix/Shell
Related entries by tags:
Script
Which?

Trackbacks
Trackback specific URI for this entry

No Trackbacks

Comments
Display comments as (Linear | Threaded)

#1 - Noons said:
2008-03-19 01:14 - (Reply)

Yikes! Hadn't seen this one mentioned since the last millenium!

Relax: just kidding.

The so-called "Unix relational commands": cut, paste, cat and pr.
:-)

Thanks for reminding me of the sanity of the Unix command line. "paste" saved me many times, together with "cut". Long before the rodent-based GUI was the norm.

And I still regularly use that same command-line. In fact, I'm finding myself more and more doing it in Windows: there are quite a few environments there that make it easier to do things in the old "cmd" screen.

Thoroughly recommend gvim for Windows, if you feel so inclined.

#1.1 - Doug Burns said:
2008-03-19 01:20 - (Reply)

Hadn't seen this one mentioned since the last millenium!

Someone needs to keep them alive ;-)

There may be a tech-political edge to this post, too. I keep seeing people FTP-ing text files to Windows so that they can manually play around with them because they don't see Unix as a fantastic text-manipulation o/s

I was really desperate last Friday too and it was with a small contented sigh that paste baled me out. Next time it'll be cut or sed (a particular favourite because I'm too much of a lightweight for awk. I've got the sed and awk book and I can't say it helped me much ...)

#1.2 - Pete Scott said:
2008-03-19 12:44 - (Reply)

sed and awk are lovely tools... I remember the Christmas I gave my wife "sed & ark in a nutshell"... that was when the relationship went downhill :-)

#2 - joel garry said:
2008-03-19 22:33 - (Reply)

Do you have the original awk book? If I didn't have that, I'd probably have to finally learn perl.

I hear what you're saying about ftp'ing to Windows, the proprietary environment I'm working in has a built-in to download the program files to whatever client editor is set up. So each editor screws with the formatting, and I can only diff my own files 'cause I'm the only one who actually works on the server. One of these days I need to set up a prettifier...

As I was in the middle of typing this, someone called me over to show me something, and they were manually deleting lines from a 79K line sqlplus listing file in notepad... thinking that is more efficient than figuring out a simple where clause...

"I can't stand it." - Charlie Brown

#2.1 - Doug Burns said:
2008-03-20 19:46 - (Reply)

I have the O'Reilly sed and awk book (sounds like the same one as Pete). In the end, sed did most of what I wanted and awk just seemed too obtuse. There are only so many languages I want to learn!

#3 - Cristian Cudizio said:
2008-03-20 08:07 - (Reply)

Very cool! as i'm always saying i've never been finished to learn. Really i use windoz visual editor to do such things. I like command line but all of us have to use the better tools to do a job. I will take a note about paste,cut and pr commands, because they may be useful.

Thanks,
Cristian

#3.1 - Doug Burns said:
2008-03-20 19:43 - (Reply)

The thing is, I'm pretty comfortable with people FTP-ing files to Windows to use WYSIWYG editors. I understand that.

What I don't really understand is why they don't sometimes FTP Windows text files up to the Unix servers for the text processing.

Whatever tool is best for the job!

(and yes, I know there are quite a few Unix-tools-on-Windows alternatives but, when the file you're working on already sits on a Unix server, I do wonder ...)

#4 - Mike 2008-03-31 14:28 - (Reply)

Ah yes, after [mumble]teen years of Solaris sysadmin'ing, I keep only a small number of books on my desk for emergency reference : Solaris Internals, and the vi O'Reilly reference book. To me, perhaps the two most useful books ever.

Awk, sed & Perl - all essential if you're serious about text processing. It's true Perl can do anything that the other two can, but sometimes it's just easier to use sed/awk for simple one-liners on the command line.


Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
BBCode format allowed
 
 

Statistics on Partitioned Tables

Contents

Part 1 - Default options - GLOBAL AND PARTITION
Part 2 - Estimated Global Stats
Part 3 - Stats Aggregation Problems I
Part 4 - Stats Aggregation Problems II
Part 5 - Minimal Stats Aggregation
Part 6a - COPY_TABLE_STATS - Intro
Part 6b - COPY_TABLE_STATS - Mistakes
Part 6c - COPY_TABLE_STATS - Bugs and Patches
Part 6d - COPY_TABLE_STATS - A Light-bulb Moment
Part 6e - COPY_TABLE_STATS - Bug 10268597

Comments

Doug Burns about 10053 Trace Files - Different Plan in Different Environments
Tue, 02.04.2013 08:57
You're welcome. Now I just nee d to pull my finger out and ac tually come up [...]
Howard Rogers about 10053 Trace Files - Different Plan in Different Environments
Mon, 01.04.2013 23:08
Makes a big difference, so tha nks for that! With two brow ser windows, o [...]
stelioscharalambides.com about 10053 Trace Files
Sat, 30.03.2013 16:28

Upcoming Presentations

Bookmark

Open All | Close All

Syndicate This Blog

  • XML RSS 2.0 feed
  • ATOM/XML ATOM 1.0 feed
  • XML RSS 2.0 Comments
  • Feedburner Feed

Powered by

Serendipity PHP Weblog

Show tagged entries

xml 11g
xml ACE
xml adaptive thresholds
xml ASH
xml Audit Vault
xml AWR
xml Blogging
xml conferences
xml Cuddly Toys
xml Database Refresh
xml DBMS_STATS
xml Direct Path Reads
xml Fun
xml grid control
xml hotsos 2010
xml listener
xml Locking
xml oow
xml oow2009
xml optimiser
xml OTN
xml Parallel
xml Partitions
xml Patching
xml swingbench
xml The Reality Gap
xml time matters
xml ukoug
xml ukoug2009
xml Unix/Shell
xml Useful Links

Disclaimer

For the avoidance of any doubt, all views expressed here are my own and not those of past or current employers, clients, friends, Oracle Corporation, my Mum or, indeed, Flatcat. If you want to sue someone, I suggest you pick on Tigger, but I hope you have a good lawyer. Frankly, I doubt any of the former agree with my views or would want to be associated with them in any way.

Design by Andreas Viklund | Conversion to s9y by Carl