Please give me suggestion. I need a working solution for sed.exe command line utility (SED build for Windows, version 4.1.5.4013). Or just give me a working UNIX-solution and i'll try to adapt it for my sed (for Win OS).
How to add the new (pretty sophisticated, to be honest) text line after specified line in a text file?
I have input file that contains following text (two lines):
[Pagebar Item Popup Menu]
Feature !Private, Item, MI_IDM_MENU_PAGEBAR_NEW_PAGE = New Page, 1,,,"New item menu"
I need to insert following line between first and second lines (above mentioned ):
Item, "Load tab" = Enable Javascript,,,,"Remove from Start Page.rtl" & Enable plugins & Enable display images & Reload
Is it possible to replace(but not to add new line every time when sed's command running!) an existing first line with two lines (replaced line + the new added string). Or, for an example, to make check if "Item, "Load tab"....." line already exists, avoid undesirable duplicates of the new line which is being inserted?
What I've tried but it didn't work:
sed -i "s/"\[Pagebar Item Popup Menu\]"/"\[Pagebar Item Popup Menu\]"\n"^Item,"Load tab"=Enable Javascript,,,,"Remove from Start Page\.rtl" & Enable plugins & Enable display images & Reload[ 0-9]\{1,\}[.,][0-9]\{3\}$/g" standard_menu.ini