Re: [OT] replace a word with a multiline with sed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le jeudi 13 mai 2010 à 18:14 +0200, Gianluca Cecchi a écrit :
> Hello,
> sorry for the offtopic. it seems a simple thing but I can't find an
> escape char or something correct...
> I have this setup in place
> source file input.txt:
> 
> bla bla
> bla bla
> TAG
> bla bla
> 
> sed command file sed.txt:
> 
> /TAG/c\
> BLABLA .... BLABLA
> 
> so that the command
> sed -f sed.txt input.txt
> gives as output
> 
> bla bla
> bla bla
> BLABLA .... BLABLA
> bla bla
> 
> Suppose I want now to substitute the TAG pattern with a multi-line
> pattern, for example
> occurences of
> TAG
> must become 2 lines:
> BLABLA
> BLOBLO
> 
> How can I achieve this?
> Thanks in advance,
> 
> Gianluca

Hi,

simply using the following pattern for sed?
   /TAG/c\
   BLABLA\nBLOBLO


Attachment: signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux