Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Find a word and delete the line Post 302181286 by gsusarla on Wednesday 2nd of April 2008 02:30:18 PM
Old 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

Delete a word and complete line

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

delete line containin specified word

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

SED to delete last word on line...what's wrong?

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

Find specific line and delete line after.

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

How to find frequent occurance of a word in a line?

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

how to find third(nth) word in all line from a file

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

delete last word of each line a directory

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

How to delete a particular word on particular line with sed?

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

How to find a string in a line in UNIX file and delete that line and previous 3 lines ?

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

Find word in a line and output in which line the word occurs / no. of times it occurred

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
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)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy