Thanks for your reply but i would like to delete the line that has the matching string and then replace the line with new string.
Hello Pradhikshan,
Following may help you in same, here I have taken an example of *.txt files, you can make it as per your requirement.
Line sed -i 's/^test test test$/"My new line here R. Singh"/g' $i; can be explained as sed -i 's/^Your required line to be changed$/"Your new line"/g' $i; Hope this helps you, let us know if you have any queries on same.
Thanks,
R. Singh
Last edited by RavinderSingh13; 09-28-2015 at 12:05 PM..
Reason: Added a comment about command explaination
This User Gave Thanks to RavinderSingh13 For This Post:
i am very new to UNIX
plz help me in this scenario
i have two text files as below
file1.txt
name=Rajakumar.
Discipline=Electronics and communication.
Designation=software Engineer.
file2.txt
name=Kannan.
Discipline=Mechanical.
Designation=CADD Design Engineer.
... (6 Replies)
Hi All,
I have a file from Mainframe which has one of the lines with so many words... i tried to fold, format to 80 chararcter.. stil did not work. So i have decided to search for a string in that line Ex.FLIGHT PLAN and once if it is found i want to delete the entire line.
Please help... (2 Replies)
Hi Guys,
I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same.
can anyone of you please let me know how to go about it ? (8 Replies)
Hi
I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall:
E.g: Actual File content:
Hello
Name: Nitin Raj
Welcome to Unix... (4 Replies)
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB and add/replace... (1 Reply)
Dear All
I am having a text file which is having more than 200 lines.
EX:
001010122 12000 BIB 12000 11200 1200003
001010122 2000 AND 12000 11200 1200003
001010122 12000 KVB 12000 11200 1200003
In the above file i want to search for string KVB... (5 Replies)
Hi,
Need your help for this scripting issue I have. I am not really good at this, so seeking your help.
I have a file looking similar to this:
Hello, i am human and name=ABCD.
How are you?
Hello, i am human and name=PQRS.
I am good.
Hello, i am human and name=ABCD.
Good bye.
Hello, i... (12 Replies)
Hi,
I have a working script.
It does what I am intending it to but a bit confused whether the sed part is supposed to be working or not. Further down is the script with the sed part that should have been working but not and the grep -v part which is the workaround that I am using at the... (10 Replies)
I have the below string which i need to compare with a file and replace this string in the file which matches closely. Can anyone help me on this.
string(Scenario 1)- user::r--,user::ourfrd:r--
String(Scenario 2)- user::r--
File
****
# file: /local/Desktop/myfile
# owner: me
# group:... (6 Replies)
Discussion started by: sarathy_a35
6 Replies
LEARN ABOUT SUSE
ausearch_add_expression
AUSEARCH_ADD_expression(3) Linux Audit API AUSEARCH_ADD_expression(3)NAME
ausearch_add_expression - build up search expression
SYNOPSIS
#include <auparse.h>
int ausearch_add_expression(auparse_state_t *au, const char *expression, char **error, ausearch_rule_t how);
DESCRIPTION
ausearch_add_item adds an expression to the current audit search expression. The search conditions can then be used to scan logs, files,
or buffers for something of interest. The expression parameter contains an expression, as specified in ausearch-expression(5).
The how parameter determines how this search expression will affect the existing search expression, if one is already defined. The possi-
ble values are:
AUSEARCH_RULE_CLEAR
Clear the current search expression, if any, and use only this search expression.
AUSEARCH_RULE_OR
If a search expression E is already configured, replace it by (E || this_search_expression).
AUSEARCH_RULE_AND
If a search expression E is already configured, replace it by (E && this_search_expression).
RETURN VALUE
If successful, ausearch_add_expression returns 0. Otherwise, it returns -1, sets errno and it may set *error to an error message; the
caller must free the error message using free(3). If an error message is not available or can not be allocated, *error is set to NULL.
SEE ALSO ausearch_add_item(3), ausearch_add_interpreted_item(3), ausearch_add_timestamp_item(3), ausearch_add_regex(3), ausearch_set_stop(3), ause-
arch_clear(3), ausearch_next_event(3), ausearch-expression(5).
AUTHOR
Miloslav Trmac
Red Hat Feb 2008 AUSEARCH_ADD_expression(3)