You're replying to a comment by nanker.

nanker Permalink
January 15, 2011, 16:42

hey I loved your SED oneliners and I can make much better use of SED having read them. I am running into a few things I would like to do with file manipulation I can find a solution for with sed and have been thinking Perl might be what I need.

In specific, I want to search a file for a particular string and the line number on which it occurs... say line 5...

5 <font>

read in the line number, add 1 (or any number I like) and enter that number as the value for the (HTML) font tags...

5 <font>6

I guess I should first ask if there is indeed a way in SED this can be easily accomplished? if not how could I do this in perl?

I am not a programmer, I get done what I need to and very little more, so the more plain the answer the better for.

currently when I run into these kinds of things I just end up fixing them manually, but I know there are better ways. I am thinking I should just dive in and spend the time to learn enough perl work from the command line in place of SED. Is that a reasonable progression do you think, if I am editting files almost daily with little tasks like this?

thanks for the help and any advice

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the word "unix_150": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.