04-02-2008
Find a word and delete the line
Hi I have a text file like this name today.txt
the request has been accepted
the scan is successful at following time
there are no invalid packages
5169378 : map : Permission Denied
the request has been accepted
Now what i want do is
I want to search the today.txt file and
if i find "permission denied" then I have to delete the whole line.
so that the text looks like this,
the request has been accepted
the scan is successful at following time
there are no invalid packages
the request has been accepted
Any help is appreciated,
gns.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi Canone please provide me solution how can achieve the result below:
File1.txt
$
sweet appleŁ1
scotish
green
$
This is a test1
$
sweet mangoŁ2
asia
yellow
$
This is a test 2
$
sweet apple red (there is no pound symbol here)
germany
green (1 Reply)
Discussion started by: Aejaz
1 Replies
2. Shell Programming and Scripting
write a shell script that deletes all lines containing a specified word in one or more files supplied as arguments to it.help is appreciated .thank you. (2 Replies)
Discussion started by: shawz
2 Replies
3. Shell Programming and Scripting
I have a line that gets pulled from a database that has a variable number of fields, fields can also be of a variable size. Each field has a variable number of spaces between them so there is no 'defined' delimiter. The LastData block is always a single word.
What I want to do is delete the... (2 Replies)
Discussion started by: Bashingaway
2 Replies
4. Shell Programming and Scripting
I'm looking for a way to search a file, in this case init.rc for a specific match, service adbd /sbin/adbd, and delete the a specific line after it
Original:
# adbd is controlled by the persist.service.adb.enable system property
service adbd /sbin/adbd
disabled
After deletion:
#... (5 Replies)
Discussion started by: GabrialDestruir
5 Replies
5. Shell Programming and Scripting
File_source.DAT
1|abc|abc|abc|abc|abc
2|abc|abc|efg|efg|def
3|abc|bcd|cde|def|efg
4|abc|abc|abc|def|efg
=========================
Please help me to solve this as below using UNIX.
=========================
File_output.DAT
"1"|"abc" - as... (3 Replies)
Discussion started by: scpyraj
3 Replies
6. Shell Programming and Scripting
For example i'm having the below contents in a file:
expr is great when you want to split a string into just two parts. The .* also makes expr good for skipping a variable number of words when you don't know how many words a string will have. But expr is lousy for getting, say, the fourth word... (2 Replies)
Discussion started by: bangarukannan
2 Replies
7. UNIX for Dummies Questions & Answers
I want to delete the last word of each line in all the files in one directory but dont know what I am doing wrong
FILES="data/*"
for X in $FILES
do
name=$(basename $X)
sed s/'\w*$'// $X > no-last/${name}
done
Can you please help me :wall: (8 Replies)
Discussion started by: A-V
8 Replies
8. UNIX for Dummies Questions & Answers
I have a file from which I am trying to delete a particular word on a particular line.
NEW
NEW
/v/engine
NEW
/ifs/list
NEW
/ifs/vdrome
NEW
I am trying to delete the first line only if it contains the word NEW. I am also trying to delete the last line only if it contains the word NEW. I... (11 Replies)
Discussion started by: newbie2010
11 Replies
9. UNIX for Advanced & Expert Users
Hi ,
i have a file with data as below.This is same file. But actual file contains to many rows.
i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ?
Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies
10. Shell Programming and Scripting
I have a file: file.txt, which contains the following data in it.
This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt
My name is not Karl, my name is Karl Joey
What is your name?
Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies
LEARN ABOUT SUNOS
ldap_delete_ext
ldap_delete(3LDAP) LDAP Library Functions ldap_delete(3LDAP)
NAME
ldap_delete, ldap_delete_s, ldap_delete_ext, ldap_delete_ext_s - LDAP delete operation
SYNOPSIS
cc[ flag... ] file... -lldap[ library... ]
#include <lber.h>
#include <ldap.h>
int ldap_delete(LDAP *ld, char *dn);
int ldap_delete_s(LDAP *ld, char *dn);
int ldap_delete_ext(LDAP *ld, char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp);
int ldap_delete_ext_s(LDAP *ld, char *dn, LDAPControl **serverctrls, LDAPControl **clientctrls);
DESCRIPTION
The ldap_delete_s() function is used to perform an LDAP delete operation synchronously. It takes dn, the DN of the entry to be deleted. It
returns an LDAP error code, indicating the success or failure of the operation.
The ldap_delete() function is used to perform an LDAP delete operation asynchronously. It takes the same parameters as ldap_delete_s(),
but returns the message id of the request it initiated. The result of the delete can be obtained by a subsequent call to
ldap_result(3LDAP).
The ldap_delete_ext() function initiates an asynchronous delete operation and returns LDAP_SUCCESS if the request was successfully sent
to the server, or else it returns a LDAP error code if not (see ldap_error(3LDAP)). If successful, ldap_delete_ext() places the message
id of the request in *msgidp. A subsequent call to ldap_result(), can be used to obtain the result of the add request.
The ldap_delete_ext_s() function initiates a synchronous delete operation and as such returns the result of the operation itself.
ERRORS
ldap_delete_s() returns an LDAP error code which can be interpreted by calling one of ldap_perror(3LDAP) functions. ldap_delete() returns
-1 if something went wrong initiating the request. It returns the non-negative message id of the request if things were successful.
ATTRIBUTES
See attributes(5) for a description of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|Availability |SUNWcsl (32-bit) |
| |SUNWcslx (64-bit) |
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
SEE ALSO
ldap(3LDAP), ldap_error(3LDAP), attributes(5)
SunOS 5.10 27 Jan 2002 ldap_delete(3LDAP)