Home » Infrastructure » Unix » Search and delete using sed command (Unix)
Search and delete using sed command [message #639294] Sun, 05 July 2015 02:58 Go to next message
hemantakhandare@gmail.com
Messages: 5
Registered: March 2015
Location: Mumbai
Junior Member
Hi Experts ,

I want to search the pattern in and condition and then only delete that line containing that character string.

---------------------------------------------------------------------------------------------------
Input :
<POSLog><Transaction SourceSystem="1"><RetailStoreID StoreLanguageCode="1033">1030</RetailStoreID><RevenueCenterID>0</RevenueCenterID><WorkstationID>2</WorkstationID><RegisterTransactionNumber >306</RegisterTransactionNumber>
--------------------------------------------------------------------------------------------------

pattern to search is

grep -n 'RegisterTransactionNumber>306' sth_sample_data.dat |grep -n 'WorkstationID>2'|grep -n '1030</RetailStoreID>'

and using sed and I want to delete that line.

I tried many ways like below but it is not working correctly

sed -e '/RegisterTransactionNumber>306/d' -e 's/WorkstationID>2/d' sth_sample_data.dat>test1.dat_4

Can anyone provide help.
Re: Search and delete using sed command [message #639295 is a reply to message #639294] Sun, 05 July 2015 04:31 Go to previous message
Michel Cadot
Messages: 65249
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

This question bears no real connection with Oracle database.
Please find a more appropriate forum.
The topic is locked. /forum/fa/448/0/
If I'm wrong, please, PM me (or report this message to a moderator, explain why you think it should be unlocked and it might be done).

In addition, if you want to get help from this forum you should seriously envisage to feedback and answer to the questions people ask you to help you and just ignore them.

Previous Topic: asvc_t, wsvc_t values from iostat command output
Next Topic: Why oracle instance doesn't shutdwon after deleting system datafile?
Goto Forum:
  


Current Time: Tue Dec 12 05:35:06 CST 2017

Total time taken to generate the page: 0.01178 seconds