I am trying to parse a file in AIX server. I could do the name in Ubuntu.
As the -i
option did not work, i used a temperory file and renamed that to the original file. Please let me know where I am missing something.
I have to find a pattern in the file and add a line above or below the pattern.
sed '/ServiceNow (TAM):/i myline1' filename > temp_file && mv temp_file filename
Actual commands used:
sed '/ServiceNow (TAM)/i servicenow.test..ersngrouplist.0=Test' /itim/data/testfile > temp_properties && mv temp_properties /itim/data/testfile
Error: sed: Function /ServiceNow (TAM)/i servicenow.test..ersngrouplist.0=Test cannot be parsed.
Please help how i can change this command to get
My Expectation:
myline1
ServiceNow (TAM): //pattern
myline2