Sponsored Content
Top Forums Shell Programming and Scripting How to delete all lines before a specific word? Post 302439768 by hakermania on Friday 23rd of July 2010 02:37:49 PM
Old 07-23-2010
thx!!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to delete specific lines at the same time

Dear All I have a pattern which look like this: 2 20080312_10:55:35.800 Spain-Telefonica ISC 9 IAM 927535957 34670505334 f 275 COT b 700 ACM b 6577 CPG b 10726 ANM b 202195 REL f 202307 RLC :COMMA: NCI=15,FCI=2101,CPC=0A,TMR=00,USI,OFI=00: :COMMB: BCI=0214,OBI=01,ACT: :RELCAUSE:10: This... (1 Reply)
Discussion started by: zanetti321
1 Replies

2. Shell Programming and Scripting

delete lines containing a specific word in afile

Hi, Please suggest how to write a shell script which delets all the lines containing the word unix in the files supplied as argument in the shell. (4 Replies)
Discussion started by: sireesha9
4 Replies

3. Shell Programming and Scripting

Delete specific lines from a file

Hi, I have a file ( all_users.ldif ) of the following format: cn=orcladmin, cn=Users, dc=maximus,dc=com cn=PUBLIC, cn=Users, dc=maximus,dc=com cn=portal,cn=users,dc=maximus,dc=com cn=portal_admin,cn=users,dc=maximus,dc=com cn=uddi_publisher,cn=Users,dc=maximus,dc=com... (4 Replies)
Discussion started by: itzz.me
4 Replies

4. Shell Programming and Scripting

search a word and delete consecutive lines below it

Hi all coders, I need a help to process some data. I have this file, 3 09/21/08 03:32:07 started undef mino Oracle nmx004.wwdc.numonyx.co m Message Text : The Oracle session with the PID 1103 has a CPU time consuming of 999.00... (3 Replies)
Discussion started by: vikas027
3 Replies

5. Shell Programming and Scripting

Delete all lines after a specific line ?

Hello. My file is like this: a b c d e f g h i I want to delete all lines after the 3rd line, means after the "c". Is there any way to do this? The lines differ between them and the lines I want to delete does not have a specific word, or the lines I want to keep (a,b,c) does not have a... (4 Replies)
Discussion started by: hakermania
4 Replies

6. Shell Programming and Scripting

A way to delete specific lines

Hi all, I hope an expert tells me that there is a way to get ride of the certain lines in my files which have no specific string on them but fixed length. It's the original pattern:... (9 Replies)
Discussion started by: GoldenFire
9 Replies

7. Shell Programming and Scripting

Search the word to be deleted and delete lines above this word starting from P1 to P3

Hi, I have to search a word in a text file and then I have to delete lines above from the word searched . For eg suppose the file is like this: Records P1 10,23423432 ,77:1 ,234:2 P2 10,9089004 ,77:1 ,234:2 ,87:123 ,9898:2 P3 456456 P1 :123,456456546 P2 abc:324234 (2 Replies)
Discussion started by: vsachan
2 Replies

8. UNIX for Dummies Questions & Answers

Delete lines with a word and their above lines

Hi, i have a file like this: A1 kdfjdljfdkljfdlf A2 lfjdlfkjddkjf A3 ***no hit*** A4 ldjfldjfdk A5 ***no hit*** A6 jldfjdlfjdlkfjd I want to remove the lines "***no hit*** and their above line to get an output file like this: (11 Replies)
Discussion started by: the_simpsons
11 Replies

9. UNIX for Dummies Questions & Answers

Quick UNIX command to display specific lines in the middle of a file from/to specific word

This could be a really dummy question. I have a log text file. What unix command to extract line from specific string to another specific string. Is it something similar to?: more +/"string" file_name Thanks (4 Replies)
Discussion started by: aku
4 Replies

10. Shell Programming and Scripting

Find specific lines between two brackets after a word

I have a file whose contents are something like below: node 'sghjknch16' { include vmware include sudo include sssd include hardening include hpom include tidal include tibco-mft-ps include jboss include... (2 Replies)
Discussion started by: proactiveaditya
2 Replies
SEM_OPEN(3)						   BSD Library Functions Manual 					       SEM_OPEN(3)

NAME
sem_open, sem_close, sem_unlink -- named semaphore operations LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <semaphore.h> sem_t * sem_open(const char *name, int oflag, ...); int sem_close(sem_t *sem); int sem_unlink(const char *name); DESCRIPTION
The sem_open() function creates or opens the named semaphore specified by name. The returned semaphore may be used in subsequent calls to sem_getvalue(3), sem_wait(3), sem_trywait(3), sem_post(3), and sem_close(). This implementation places strict requirements on the value of name: it must begin with a slash ('/') and contain no other slash characters. The following bits may be set in the oflag argument: O_CREAT Create the semaphore if it does not already exist. The third argument to the call to sem_open() must be of type mode_t and specifies the mode for the semaphore. Only the S_IWUSR, S_IWGRP, and S_IWOTH bits are examined; it is not possible to grant only ``read'' permission on a semaphore. The mode is modified according to the process's file creation mask; see umask(2). The fourth argument must be an unsigned int and specifies the initial value for the semaphore, and must be no greater than SEM_VALUE_MAX. O_EXCL Create the semaphore if it does not exist. If the semaphore already exists, sem_open() will fail. This flag is ignored unless O_CREAT is also specified. The sem_close() function closes a named semaphore that was opened by a call to sem_open(). The sem_unlink() function removes the semaphore named name. Resources allocated to the semaphore are only deallocated when all processes that have the semaphore open close it. RETURN VALUES
If successful, the sem_open() function returns the address of the opened semaphore. If the same name argument is given to multiple calls to sem_open() by the same process without an intervening call to sem_close(), the same address is returned each time. If the semaphore cannot be opened, sem_open() returns SEM_FAILED and the global variable errno is set to indicate the error. The sem_close() and sem_unlink() functions return the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The sem_open() function will fail if: [EACCES] The semaphore exists and the permissions specified by oflag at the time it was created deny access to this process. [EACCES] The semaphore does not exist, but permission to create it is denied. [EEXIST] O_CREAT and O_EXCL are set but the semaphore already exists. [EINTR] The call was interrupted by a signal. [EINVAL] The sem_open() operation is not supported for the given name. [EINVAL] The value argument is greater than SEM_VALUE_MAX. [ENAMETOOLONG] The name argument is too long. [ENFILE] The system limit on semaphores has been reached. [ENOENT] O_CREAT is not set but the named semaphore does not exist. [ENOSPC] There is not enough space to create the semaphore. The sem_close() function will fail if: [EINVAL] The sem argument is not a valid semaphore. The sem_unlink() function will fail if: [EACCES] Permission is denied to unlink the semaphore. [ENAMETOOLONG] The specified name is too long. [ENOENT] The named semaphore does not exist. SEE ALSO
close(2), open(2), umask(2), unlink(2), sem_getvalue(3), sem_post(3), sem_trywait(3), sem_wait(3) STANDARDS
The sem_open(), sem_close(), and sem_unlink() functions conform to ISO/IEC 9945-1:1996 (``POSIX.1''). HISTORY
Support for named semaphores first appeared in FreeBSD 5.0. BSD
January 9, 2010 BSD
All times are GMT -4. The time now is 11:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy