Sponsored Content
Top Forums Shell Programming and Scripting search and delete the lines in a file Post 302627737 by chapeupreto on Saturday 21st of April 2012 03:10:27 PM
Old 04-21-2012
a few more ways:
Code:
sed '/#/d' infile.txt > newfile.txt

Code:
sed -n '/#/!p' infile.txt > newfile.txt

Code:
grep -v '#' infile.txt > newfile.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

search 2 lines and delete above line

Hi, I've been searching in this forum for the last 4 hours trying to do one thing: search 2 lines and delete the above line. So far I have not be able to find something similar in this forum, so I need help. This is what I'm trying to do. For example, I have a file called file1: file1 word1... (4 Replies)
Discussion started by: shamushamu
4 Replies

2. 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

3. Shell Programming and Scripting

search for keyword in subsequent lines and delete the second line

I have my data something like this I need to search for the keyword yyyy in the susequent lines and if it is present, delete the second line with keyword. In other words, if a keywords is found in two subsequent lines delete the second line. input data: aaaa bbbbb cccc dddd xxxx... (4 Replies)
Discussion started by: rdhanek
4 Replies

4. Shell Programming and Scripting

Delete new lines based on search criteria

Hi all! A bit of background: I am trying to create a script that formats SQL statements. I have gotten so far as to add new lines based on certain match criteria like commas, keywords etc. In the process, I end up adding newlines where I don't want. For example: substr(colName, 1, 10)... (3 Replies)
Discussion started by: jayarkay
3 Replies

5. UNIX for Advanced & Expert Users

In a huge file, Delete duplicate lines leaving unique lines

Hi All, I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space. I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
Discussion started by: krishnix
16 Replies

6. Shell Programming and Scripting

search and replace, when found, delete multiple lines, add new set of lines?

hey guys, I tried searching but most 'search and replace' questions are related to one liners. Say I have a file to be replaced that has the following: $ cat testing.txt TESTING AAA BBB CCC DDD EEE FFF GGG HHH ENDTESTING This is the input file: (3 Replies)
Discussion started by: DeuceLee
3 Replies

7. Shell Programming and Scripting

sed search pattern and delete lines

Hello, i have a question. My problem is that i have a file like: TEST JOHN ADAM MICHAEL SEBASTIAN ANDY i want find for MICHAEL and want delete lines like this: TEST (4 Replies)
Discussion started by: eightball
4 Replies

8. Shell Programming and Scripting

Need To Delete Lines Based On Search Criteria

Hi All, I have following input file. I wish to retain those lines which match multiple search criteria. The search criteria is stored in a variable seperated from each other by comma(,). SEARCH_CRITERIA = "REJECT, DUPLICATE" Input File: ERROR,MYFILE_20130214_11387,9,37.75... (3 Replies)
Discussion started by: angshuman
3 Replies

9. Shell Programming and Scripting

Search 2 days older file and then delete last 10 lines

I want to search 2 day older file and then delete last 10 line of that file. (2 Replies)
Discussion started by: sonu pandey
2 Replies

10. UNIX for Beginners Questions & Answers

How to search & delete inclusively between two lines?

Hi all, I was wondering if anyone would know how to search & delete inclusively between two lines, please: Important: There are multiple }; lines. I'm curious how to delete the correct one only. Line numbers may vary each time this script is run. For example, I'd like to delete only the... (6 Replies)
Discussion started by: chatguy
6 Replies
dladdr(3C)																dladdr(3C)

NAME
dladdr, dladdr1 - translate address to symbolic information SYNOPSIS
#include <dlfcn.h> int dladdr(void *address, Dl_info *dlip); int dladdr1(void *address, Dl_info *dlip, void **info, int flags); The dladdr() and dladdr1() functions determine if the specified address is located within one of the mapped objects that make up the cur- rent applications address space. An address is deemed to fall within a mapped object when it is between the base address, and the _end address of that object. See . If a mapped object fits this criteria, the symbol table made available to the runtime linker is searched to locate the nearest symbol to the specified address. The nearest symbol is one that has a value less than or equal to the required address. The Dl_info structure must be preallocated by the user. The structure members are filled in by dladdr(), based on the specified address. The Dl_info structure includes the following members: const char * dli_fname; void * dli_fbase; const char * dli_sname; void * dli_saddr; The Dl_info members provide the following information. dli_fname Contains a pointer to the filename of the containing object. dli_fbase Contains the base address of the containing object. dli_sname Contains a pointer to the symbol name that is nearest to the specified address. This symbol either represents the exact address that was specified, or is the nearest symbol with a lower address. dli_saddr Contains the actual address of the symbol pointed to by dli_sname. The dladdr1() function provides for addition information to be returned as specified by the flags argument: RTLD_DL_SYMENT Obtain the ELF symbol table entry for the matched symbol. The info argument points to a symbol pointer as defined in <sys/elf.h> (Elf32_Sym **info or Elf64_Sym **info). RTLD_DL_LINKMAP Obtain the Link_map for the matched file. The info argument points to a Link_map pointer as defined in <sys/link.h> (Link_map **info). If the specified address cannot be matched to a mapped object, a 0 is returned. Otherwise, a non-zero return is made and the associated Dl_info elements are filled. The dladdr() and dladdr1() functions are one of a family of functions that give the user direct access to the dynamic linking facilities. These facilities are available to dynamically-linked processes only. See . See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ ld(1), dlclose(3C), dldump(3C), dlerror(3C), dlopen(3C), dlsym(3C), attributes(5) The Dl_info pointer elements point to addresses within the mapped objects. These pointers can become invalid if objects are removed prior to these elements use. See dlclose(3C). If no symbol is found to describe the specified address, both the dli_sname and dli_saddr members are set to 0. If an object is acting as a filter, care should be taken when interpreting the address of any symbol obtained using a handle to this object. For example, using dlsym(3C) to obtain the symbol _end for this object, results in returning the address of the symbol _end within the filtee, not the filter. For more information on filters see the . 26 Sep 2005 dladdr(3C)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy