Day 4 – Falling back to the meta-referance
Last night I posted on twitter that I was struggling to find stuff to post about. jkblacker (Not bassets, sorry Josh!) suggested that I post about how I’m finding it hard to find stuff to post about… so here it is
Not exactly the most spectacular day 4, especially since I’ve got 26 left to go, but we’ll see what happens.
Parts for my new computer started arriving today. I’d hoped that it would all arrive, but unfortunately not. So, right now I’ve got RAM, the PSU, Motherboard, CPU cooler and a copy of Windows. (Yes, I know, horrible, but I’m building a gaming machine, wine isn’t there yet, and Linux hasn’t reached critical mass
)
Sporadically over the past week or so, I’ve been trying to use search and replace in vi/vim. Finally got it drummed into my head! Here’s the syntax for single item search and replace:
:%s/OLDSTRING/NEWSTRING/
If you want to replace every item in a document, then add “g” to the very end. “g” in this context means “greedy” – i.e. replace everything. (Thanks JPE – I did learn it after all!)
This is the same sort of syntax as usable in the command line tool “sed”. For example, if you wanted to replace a space in a file with a comma, then you’d do:
sed 's/ /,/g' oldfile > newfile
I’m sure there’s a better way to specify that syntax… please feel free to comment
Tags: Linux, meta-reference, sed, twitter
This entry was posted on Tuesday, November 4th, 2008 at 21:32 by Kirrus and is filed under General, Linux, Remember This. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
I'm a 23 year old Christian, Geek, Bookworm,
Socially Inept guy living in Cambridgeshire.
Ah you should have gotten a copy of Codeweavers Crossover Pro for free last week!
I did! I’ll try it out once I’ve got Ubuntu installed, but that’s going to come after installing windows. I’ve not got much hope that it’ll work well enough though
Apology accepted – I did notice this and forgot to mention, good to see someone pointed out the mistake
Keep up the blogging, just don’t stop after a month!
I noticed it when I re-read the post at some point
I’ll try not to stop! I probably won’t post once a day though (unless you really want me to
)