Sponsored Content
Top Forums Shell Programming and Scripting Search and Remove Lines within File Post 302391445 by leepet01 on Monday 1st of February 2010 10:45:19 AM
Old 02-01-2010
Thanks, anbu23! That did it!!!

Thank you dpc. I'm learning bash and wrote your script down for future purposes.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

different take on common ?: search for two strings and remove lines between them

Thank you for assisting, I've got a partial solution just needs a tweak. Hulk-BASH$ cat somefile.txt oh there is some stuff here some more stuff here START_LABEL stuff I want more stuff I want END_LABEL other stuff here too and even more stuff here too Hulk-BASH$ Hulk-BASH$ sed... (8 Replies)
Discussion started by: laser
8 Replies

2. UNIX for Dummies Questions & Answers

vi to remove lines in file

All, I have a text file with several entries like below: personname personname.domain.com I know there is a way to use vi to remove only the personname.domain.com line. Can someone help? I believe that it involves /s/g/ something...I just can't remember the exact syntax. Thanks (2 Replies)
Discussion started by: kjbaumann
2 Replies

3. Shell Programming and Scripting

remove lines from file

Hi gurus, i'm trying to remove a number of lines from a large file using the following command: sed '1,5000d' oldfile > newfile Somehow the lines in the old file are not deleted... Am I doing this wrongly? Any suggestions? :confused: Thanks! :) wee (10 Replies)
Discussion started by: lweegp
10 Replies

4. Shell Programming and Scripting

remove : lines from file

A small question I have a test.txt file I have contents as: a:google b:yahoo : c:facebook : d:hotmail How do I remove the line with : my output should be a:google b:yahoo c:facebook d:hotmail (5 Replies)
Discussion started by: aronmelon
5 Replies

5. Shell Programming and Scripting

Search and remove in a text file

Need help whit a script where I have to input a name and then remove a line where that name is in a file file ex: 001op;Name;Location;date 002op;Name;Location;date and so on.... can anybody help me??? thanks (4 Replies)
Discussion started by: nogame11
4 Replies

6. Shell Programming and Scripting

Search based on 1,2,4,5 columns and remove duplicates in the same file.

Hi, I am unable to search the duplicates in a file based on the 1st,2nd,4th,5th columns in a file and also remove the duplicates in the same file. Source filename: Filename.csv "1","ccc","information","5000","temp","concept","new" "1","ddd","information","6000","temp","concept","new"... (2 Replies)
Discussion started by: onesuri
2 Replies

7. Shell Programming and Scripting

Search and remove the lines

Hallo Team, Hope you are having a wonderful Friday. Here goes i am searching for a pattern and after finding the lines which contain this pattern i want to remove/delete them. This is my code: grep Originating BW*2013*|grep -v "ACCOUNT NOT FOUND"|grep -v "Unknown called number"|grep -v... (2 Replies)
Discussion started by: kekanap
2 Replies

8. Shell Programming and Scripting

How to search multiple patterns and remove lines from a file?

Hi, I have a file content as below. Table : PAYR Displayed fields: 15 of 15 Fixed columns: 4 List width 0999... (4 Replies)
Discussion started by: shirdi
4 Replies

9. UNIX for Dummies Questions & Answers

Want to remove all lines but not latest 50 lines from a file

Hi, I have a huge file which has Lacs of lines. File system got full. I want your guys help to suggest me a solution so that I can remove all lines from that file but not last 50,000 lines. I want solution which can remove lines from existing file so that I can have some space left with. (28 Replies)
Discussion started by: prashant2507198
28 Replies

10. Shell Programming and Scripting

Remove lines that are subsets of other lines in File

Hello everyone, Although it seems easy, I've been stuck with this problem for a moment now and I can't figure out a way to get it done. My problem is the following: I have a file where each line is a sequence of IP addresses, example : 10.0.0.1 10.0.0.2 10.0.0.5 10.0.0.1 10.0.0.2... (5 Replies)
Discussion started by: MisterJellyBean
5 Replies
File::Remove(3) 					User Contributed Perl Documentation					   File::Remove(3)

NAME
File::Remove - Remove files and directories SYNOPSIS
use File::Remove 'remove'; # removes (without recursion) several files remove( '*.c', '*.pl' ); # removes (with recursion) several directories remove( 1, qw{directory1 directory2} ); # removes (with recursion) several files and directories remove( 1, qw{file1 file2 directory1 *~} ); # trashes (with support for undeleting later) several files trash( '*~' ); DESCRIPTION
File::Remove::remove removes files and directories. It acts like /bin/rm, for the most part. Although "unlink" can be given a list of files, it will not remove directories; this module remedies that. It also accepts wildcards, * and ?, as arguments for filenames. File::Remove::trash accepts the same arguments as remove, with the addition of an optional, infrequently used "other platforms" hashref. SUBROUTINES
remove Removes files and directories. Directories are removed recursively like in rm -rf if the first argument is a reference to a scalar that evaluates to true. If the first arguemnt is a reference to a scalar then it is used as the value of the recursive flag. By default it's false so only pass 1 to it. In list context it returns a list of files/directories removed, in scalar context it returns the number of files/directories removed. The list/number should match what was passed in if everything went well. rm Just calls remove. It's there for people who get tired of typing remove. clear The "clear" function is a version of "remove" designed for use in test scripts. It takes a list of paths that it will both initially delete during the current test run, and then further flag for deletion at END-time as a convenience for the next test run. trash Removes files and directories, with support for undeleting later. Accepts an optional "other platforms" hashref, passing the remaining arguments to remove. Win32 Requires Win32::FileOp. Installation not actually enforced on Win32 yet, since Win32::FileOp has badly failing dependencies at time of writing. OS X Requires Mac::Glue. Other platforms The first argument to trash() must be a hashref with two keys, 'rmdir' and 'unlink', each referencing a coderef. The coderefs will be called with the filenames that are to be deleted. SUPPORT
Bugs should always be submitted via the CPAN bug tracker <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Remove> For other issues, contact the maintainer. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Some parts copyright 2006 - 2012 Adam Kennedy. Taken over by Adam Kennedy <adamk@cpan.org> to fix the "deep readonly files" bug, and do some package cleaning. Some parts copyright 2004 - 2005 Richard Soderberg. Taken over by Richard Soderberg <perl@crystalflame.net> to port it to File::Spec and add tests. Original copyright: 1998 by Gabor Egressy, <gabor@vmunix.com>. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. perl v5.16.3 2012-03-19 File::Remove(3)
All times are GMT -4. The time now is 04:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy