LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   replace lines matching a pattern (https://www.linuxquestions.org/questions/linux-newbie-8/replace-lines-matching-a-pattern-4175530905/)

victordcweb 01-13-2015 11:39 AM

replace lines matching a pattern
 
I have several files in that I need to add the text "N CHAR(1)," How can I accomplish this in linux without having to do it manually. Thanks

HAVE

nullcols
(A "to_number(:A,'9')"
,B CHAR(50)
)

WANT

nullcols
(N CHAR(1)
,A "to_number(:A,'9')"
,B CHAR(50)
)

pan64 01-13-2015 11:43 AM

you need to check the command sed:
sed 's/<search string>/<replace string>/' filename is the syntax, you will need to set nullcols as <search string> and the two lines together as replacement.
see man page of sed for additional possibilities, flags and usage (or look for examples on the net).


All times are GMT -5. The time now is 07:54 AM.