Wednesday, August 28, 2013

Unix sed: Modify xml file or move characters around

Following example can be used when we want to move characters around in the file based on xml tags or other character prefixes.

I wanted to remove sequencenumber tag along with value within tags from following line. I also wanted to move tags salary and suffix to first position after begin.

101886122arpit23452345shah116056III

Following script can help:
$ sed 's:\(\)\(.*\)\(.*last>\)\(.*suffix>\)\(.*\):\1\4\3\5:' a


116056IIIarpit23452345shah  

Friday, January 11, 2013


My (Arpit's) Art of Living Experience in Initial Days

Image
A lucky break (or, really, drag)
What’s incredible about my story is that my friend dragged me along to this course, which I had no intention of attending, but then, somehow, I liked it. And he…didn’t. Fast forward to now, and I have no idea what my life would be like without it had he not done that that day. What an unrepayable debt I owe to him!! I’m actually not sure if he’s done it yet or not – I will have to check and make him do it soon : ).
Image
Pray, don’t spray
All was well — for a while. The course was going fine, but when I started doing that vigorous breathing exercise (what did they call it?), snot came flying out of my nose in ridiculous quantities. I was worried!!! What would the people around me think? It is actually a miracle, in retrospect, that I stuck with it through all that. But, I guess with the power of the Kriya and pranayams, don’t you know it, in a couple of months, it went away!!!
Image
Tongue (and body)-tied
One thing that I noticed after the course was that I was able to speak. Not that I wasn’t able to speak before – I’m talking about giving speeches. When I used to do it, I would shake like crazy, jumble up my words like I didn’t know my own language, and rush through it, barely enunciating and hardly giving anyone a chance to hear or think. But somehow, after some simple body-breath-coordination exercises, it was gone – not completely, but a lot. Before, when I would give presentations for whatever reason in school, I would always rank near the bottom – I don’t even know how low, they didn’t tell me (probably good, to save my feelings). But the first time I spoke after the course, I got third out of a large group!!!! AMAZING!!!!
Above mentioned is true. I had help of Great writer Sanjay Kapoor in writing and adding images. Thanks Sanjay!