Search and delete using sed command [message #639294] |
Sun, 05 July 2015 02:58 |
|
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.
|
|
|
|